source:
issm/oecreview/Archive/14312-15392/ISSM-14550-14551.diff@
15393
Last change on this file since 15393 was 15393, checked in by , 12 years ago | |
---|---|
File size: 3.2 KB |
-
../trunk-jpl/src/c/shared/Exp/exp.h
90 90 /*Do a first pass through the domainname file, to figure out how many profiles we need to read: */ 91 91 nprof=1; 92 92 for(;;){ 93 fscanf(fid,"%255s %255s\n",chardummy,chardummy); 94 fscanf(fid,"%255s %255s\n",chardummy,chardummy); 95 fscanf(fid,"%255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy); 96 fscanf(fid,"%20u %255s\n",&n,chardummy); 97 fscanf(fid,"%255s %255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy,chardummy); 98 for (i=0;i<n;i++) fscanf(fid,"%20lf %20lf\n",&ddummy,&ddummy); 93 //## Name:filename 94 if(fscanf(fid,"%255s %255s\n",chardummy,chardummy)!=2) _error_("Could not read " << domainname); 95 //## Icon:0 96 if(fscanf(fid,"%255s %255s\n",chardummy,chardummy)!=2) _error_("Could not read " << domainname); 97 //# Points Count Value 98 if(fscanf(fid,"%255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy)!=4) _error_("Could not read " << domainname); 99 if(fscanf(fid,"%20u %255s\n",&n,chardummy)!=2) _error_("Could not read number of points in "<<domainname); 100 //# X pos Y pos 101 if(fscanf(fid,"%255s %255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy,chardummy)!=5) _error_("Could not read " << domainname); 102 for (i=0;i<n;i++){ 103 if(fscanf(fid,"%20lf %20lf\n",&ddummy,&ddummy)!=2){ 104 _error_("Could not read coordinate of vertex "<< i <<" of "<<domainname); 105 } 106 } 99 107 /*check whether we are at the end of the file, otherwise, keep reading next profile:*/ 100 if 108 if(feof(fid)) break; 101 109 nprof++; 102 110 } 103 111 … … 118 126 for(counter=0;counter<nprof;counter++){ 119 127 120 128 /*Skip header: */ 121 fscanf(fid,"%255s %255s\n",chardummy,chardummy); 122 fscanf(fid,"%255s %255s\n",chardummy,chardummy); 123 fscanf(fid,"%255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy); 129 //## Name:filename 130 if(fscanf(fid,"%255s %255s\n",chardummy,chardummy)!=2) _error_("Could not read " << domainname); 131 //## Icon:0 132 if(fscanf(fid,"%255s %255s\n",chardummy,chardummy)!=2) _error_("Could not read " << domainname); 133 //# Points Count Value 134 if(fscanf(fid,"%255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy)!=4) _error_("Could not read " << domainname); 124 135 125 136 /*Get number of profile vertices: */ 126 fscanf(fid,"%20u %255s\n",&n,chardummy);137 if(fscanf(fid,"%20u %255s\n",&n,chardummy)!=2) _error_("Could not read number of points in "<<domainname); 127 138 128 139 /*Skip next line: */ 129 fscanf(fid,"%255s %255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy,chardummy); 140 //# X pos Y pos 141 if(fscanf(fid,"%255s %255s %255s %255s %255s\n",chardummy,chardummy,chardummy,chardummy,chardummy)!=5) _error_("Could not read " << domainname); 130 142 131 143 /*Allocate vertices: */ 132 144 x=xNew<doubletype>(n); … … 134 146 135 147 /*Read vertices: */ 136 148 for (i=0;i<n;i++){ 137 fscanf(fid,"%20lf %20lf\n",&x[i],&y[i]); 149 if(fscanf(fid,"%20lf %20lf\n",&x[i],&y[i])!=2){ 150 _error_("Could not read coordinate of vertex "<<i<<" of "<<domainname); 151 } 138 152 } 139 153 140 154 /*Now check that we are dealing with open contours: */
Note:
See TracBrowser
for help on using the repository browser.