Changeset 14293
- Timestamp:
- 01/31/13 10:25:24 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r14279 r14293 741 741 ./shared/Exp/IsInPoly.cpp\ 742 742 ./shared/Exp/IsInPolySerial.cpp\ 743 ./shared/Exp/ DomainOutlineWrite.cpp\743 ./shared/Exp/ExpWrite.cpp\ 744 744 ./shared/TriMesh/trimesh.h\ 745 745 ./shared/TriMesh/AssociateSegmentToElement.cpp\ -
issm/trunk-jpl/src/c/shared/Elements/PrintArrays.cpp
r13914 r14293 39 39 _printLine_(""); 40 40 } 41 void printarray(bool* array,int lines,int cols){ 42 _printLine_(""); 43 for(int i=0;i<lines;i++){ 44 _printString_(" [ "); 45 for(int j=0;j<cols;j++) _printString_( " " << array[i*cols+j]?1:0); 46 _printLine_(" ]"); 47 } 48 _printLine_(""); 49 } 41 50 void printbinary(int n){ 42 51 unsigned int i=1L<<(sizeof(n)*8-1); -
issm/trunk-jpl/src/c/shared/Elements/elements.h
r13901 r14293 40 40 void printarray(IssmPDouble* array,int lines,int cols=1); 41 41 void printarray(int* array,int lines,int cols=1); 42 void printarray(bool* array,int lines,int cols=1); 42 43 void printsparsity(IssmPDouble* array,int lines,int cols=1); 43 44 void printbinary(int n); -
issm/trunk-jpl/src/c/shared/Exp/ExpWrite.cpp
r14292 r14293 1 /*!\file: DomainOutlineWrite.cpp2 * \brief DomainOutlineWrite.c: write the vertex coordinates defined in a domain1 /*!\file: Exp.cpp 2 * \brief Exp.cpp: write the vertex coordinates defined in a domain 3 3 * outline from Argus (.exp file). The first contour in the file is for 4 * the outside domain outline. The following contours represent holes in 5 * the domain. 4 * the outside domain outline. 6 5 */ 7 8 6 #include <stdio.h> 9 7 #include "../Alloc/alloc.h" 10 8 #include "../../include/include.h" 11 9 #include "../Exceptions/exceptions.h" 10 #include "../../Container/DataSet.h" 11 #include "../../classes/objects/Contour.h" 12 12 13 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname){ 14 15 /*Error management: */ 16 int noerr=1; 17 int i,counter; 13 int ExpWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,char* domainname){/*{{{*/ 18 14 19 15 /*I/O: */ … … 21 17 22 18 /*open domain outline file for writing: */ 23 if ((fid=fopen(domainname,"w"))==NULL){ 24 _error_("could not open domain file " << domainname); 25 noerr=0; goto cleanupandreturn; 26 } 19 if((fid=fopen(domainname,"w"))==NULL) _error_("could not open domain file " << domainname); 27 20 28 21 /*Start writing profiles: */ 29 for( counter=0;counter<nprof;counter++){22 for(int counter=0;counter<nprof;counter++){ 30 23 31 24 /*Write header: */ 32 fprintf(fid,"%s %s\n","##","Name:"); 33 fprintf(fid,"%s %s\n","##","Icon:0"); 34 fprintf(fid,"%s %s %s %s\n","#","Points","Count","Value"); 35 36 /*Write number of profile vertices: */ 25 fprintf(fid,"## Name:%s\n",domainname); 26 fprintf(fid,"## Icon:0\n"); 27 fprintf(fid,"# Points Count Value\n"); 37 28 fprintf(fid,"%u %s\n",profnvertices[counter] ,"1."); 38 39 /*Write next line: */ 40 fprintf(fid,"%s %s %s %s %s\n","#","X","pos","Y","pos"); 29 fprintf(fid,"# X pos Y pos\n"); 41 30 42 31 /*Write vertices: */ 43 for (i=0;i<profnvertices[counter];i++){32 for(int i=0;i<profnvertices[counter];i++){ 44 33 fprintf(fid,"%lf\t%lf\n",pprofx[counter][i],pprofy[counter][i]); 45 34 } 46 35 47 36 /*Write blank line: */ 48 if(counter <nprof-1) fprintf(fid,"\n");37 if(counter<nprof-1) fprintf(fid,"\n"); 49 38 } 50 39 51 /*close domain outlinefile: */40 /*close Exp file: */ 52 41 fclose(fid); 53 42 54 cleanupandreturn: 55 return noerr; 56 } 43 return 1; 44 }/*}}}*/ 45 int ExpWrite(DataSet* contours,char* domainname){/*{{{*/ 46 47 /*I/O: */ 48 FILE* fid=NULL; 49 Contour<double>* contour = NULL; 50 51 /*open domain outline file for writing: */ 52 if((fid=fopen(domainname,"w"))==NULL) _error_("could not open domain file " << domainname); 53 54 for(int counter=0;counter<contours->Size();counter++){ 55 contour=(Contour<double>*)contours->GetObjectByOffset(counter); 56 57 /*Write header: */ 58 fprintf(fid,"## Name:%s\n",domainname); 59 fprintf(fid,"## Icon:0\n"); 60 fprintf(fid,"# Points Count Value\n"); 61 fprintf(fid,"%u %s\n",contour->nods ,"1."); 62 fprintf(fid,"# X pos Y pos\n"); 63 64 /*Write vertices: */ 65 for(int i=0;i<contour->nods;i++){ 66 fprintf(fid,"%lf\t%lf\n",contour->x[i],contour->y[i]); 67 } 68 69 /*Write blank line: */ 70 if(counter<contours->Size()-1) fprintf(fid,"\n"); 71 } 72 73 /*close Exp file: */ 74 fclose(fid); 75 76 return 1; 77 }/*}}}*/ -
issm/trunk-jpl/src/c/shared/Exp/exp.h
r13813 r14293 12 12 13 13 int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue); 14 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname); 14 int ExpWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,char* domainname); 15 int ExpWrite(DataSet* contours,char* domainname); 15 16 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue); 16 17
Note:
See TracChangeset
for help on using the changeset viewer.