- Timestamp:
- 04/16/12 16:06:52 (13 years ago)
- Location:
- issm/branches/trunk-jpl-damage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-jpl-damage
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 11709,11711-11769,11771-11777,11780-11782,11784-11800,11803-11983,11986-11989
- Property svn:mergeinfo changed
-
issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineRead.cpp
r9320 r12004 9 9 #include "../Alloc/alloc.h" 10 10 #include "../../include/include.h" 11 #include "../../objects/objects.h" 11 12 #include "../Exceptions/exceptions.h" 13 #include "../../Container/DataSet.h" 12 14 13 15 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole=true){ 14 16 15 17 16 /*Error management: */ 17 int noerr=1; 18 /*indexing: */ 18 19 int i,counter; 19 20 … … 39 40 if ((fid=fopen(domainname,"r"))==NULL){ 40 41 _error_("%s%s","could not find domain file ",domainname); 41 noerr=0; goto cleanupandreturn;42 42 } 43 43 … … 95 95 /*Read vertices: */ 96 96 for (i=0;i<n;i++){ 97 fscanf(fid,"%20lf %20lf\n", x+i,y+i);97 fscanf(fid,"%20lf %20lf\n",&x[i],&y[i]); 98 98 } 99 99 … … 117 117 fclose(fid); 118 118 119 cleanupandreturn:120 /*Free ressources: */121 if(!noerr){122 xfree((void**)&x);123 xfree((void**)&y);124 n=-1;125 }126 127 119 /*Assign output pointers: */ 128 120 *pnprof=nprof; … … 132 124 if(pclosed)*pclosed=closed; 133 125 else xfree((void**)&closed); 134 return noerr;135 126 } 136 127 128 DataSet* DomainOutlineRead(char* domainname,bool whole=true){ 129 130 /*indexing: */ 131 int i; 132 133 /*intermediary: */ 134 int nprof; 135 int* profnvertices=NULL; 136 double** pprofx=NULL; 137 double** pprofy=NULL; 138 139 Contour* contour=NULL; 140 141 /*output: */ 142 DataSet* domain=NULL; 143 144 /*get domain outline from intermediary function:*/ 145 DomainOutlineRead(&nprof,&profnvertices,&pprofx, &pprofy, NULL,domainname,whole); 146 147 /*now create dataset of contours: */ 148 domain=new DataSet(0); 149 150 for(i=0;i<nprof;i++){ 151 domain->AddObject(new Contour(i,profnvertices[i],pprofx[i],pprofy[i],1)); 152 } 153 154 return domain; 155 }
Note:
See TracChangeset
for help on using the changeset viewer.