/*!\file: DomainOutlineRead.cpp * \brief DomainOutlineRead.c: read the vertex coordinates defined in a domain * outline from Argus (.exp file). The first contour in the file is for * the outside domain outline. The following contours represent holes in * the domain. */ #include #include "../Alloc/alloc.h" #include "../../include/include.h" #include "../../objects/objects.h" #include "../Exceptions/exceptions.h" #include "../../Container/DataSet.h" int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole=true){ /*indexing: */ int i,counter; /*I/O: */ FILE* fid=NULL; char chardummy[256]; double ddummy; /*output: */ int nprof; //number of profiles in the domainname file int* profnvertices=NULL; //array holding the number of vertices for the nprof profiles double** pprofx=NULL; //array of profiles x coordinates double** pprofy=NULL; //array of profiles y coordinates bool* closed=NULL; //array holding closed flags for the nprof profiles /*For each profile: */ int n; double* x=NULL; double* y=NULL; bool cl; /*open domain outline file for reading: */ if ((fid=fopen(domainname,"r"))==NULL){ _error_("%s%s","could not find domain file ",domainname); } /*Do a first pass through the domainname file, to figure out how many profiles *we need to read: */ nprof=1; for(;;){ fscanf(fid,"%256s %256s\n",chardummy,chardummy); fscanf(fid,"%256s %256s\n",chardummy,chardummy); fscanf(fid,"%256s %256s %256s %256s\n",chardummy,chardummy,chardummy,chardummy); fscanf(fid,"%20u %256s\n",&n,chardummy); fscanf(fid,"%256s %256s %256s %256s %256s\n",chardummy,chardummy,chardummy,chardummy,chardummy); for (i=0;iAddObject(new Contour(i,profnvertices[i],pprofx[i],pprofy[i],1)); } printf("ok2\n"); return domain; }