| 1 | /*!\file: DomainOutlineWrite.cpp
|
|---|
| 2 | * \brief DomainOutlineWrite.c: write the vertex coordinates defined in a domain
|
|---|
| 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.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include <stdio.h>
|
|---|
| 9 | #include "../Alloc/alloc.h"
|
|---|
| 10 | #include "../../include/include.h"
|
|---|
| 11 | #include "../Exceptions/exceptions.h"
|
|---|
| 12 |
|
|---|
| 13 | int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname){
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | /*Error management: */
|
|---|
| 17 | int noerr=1;
|
|---|
| 18 | int i,counter;
|
|---|
| 19 |
|
|---|
| 20 | /*I/O: */
|
|---|
| 21 | FILE* fid=NULL;
|
|---|
| 22 |
|
|---|
| 23 | /*open domain outline file for writing: */
|
|---|
| 24 | if ((fid=fopen(domainname,"w"))==NULL){
|
|---|
| 25 | _error_("%s%s","could not open domain file ",domainname);
|
|---|
| 26 | noerr=0; goto cleanupandreturn;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | /*Start writing profiles: */
|
|---|
| 30 | for(counter=0;counter<nprof;counter++){
|
|---|
| 31 |
|
|---|
| 32 | /*Write header: */
|
|---|
| 33 | fprintf(fid,"%s %s\n","##","Name:");
|
|---|
| 34 | fprintf(fid,"%s %s\n","##","Icon:0");
|
|---|
| 35 | fprintf(fid,"%s %s %s %s\n","#","Points","Count","Value");
|
|---|
| 36 |
|
|---|
| 37 | /*Write number of profile vertices: */
|
|---|
| 38 | fprintf(fid,"%u %s\n",profnvertices[counter] ,"1.");
|
|---|
| 39 |
|
|---|
| 40 | /*Write next line: */
|
|---|
| 41 | fprintf(fid,"%s %s %s %s %s\n","#","X","pos","Y","pos");
|
|---|
| 42 |
|
|---|
| 43 | /*Write vertices: */
|
|---|
| 44 | for (i=0;i<profnvertices[counter];i++){
|
|---|
| 45 | fprintf(fid,"%lf\t%lf\n",pprofx[counter][i],pprofy[counter][i]);
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | /*Write blank line: */
|
|---|
| 49 | if(counter < nprof-1) fprintf(fid,"\n");
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | /*close domain outline file: */
|
|---|
| 53 | fclose(fid);
|
|---|
| 54 |
|
|---|
| 55 | cleanupandreturn:
|
|---|
| 56 | return noerr;
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|