source: issm/trunk/src/c/classes/Contours.cpp@ 18301

Last change on this file since 18301 was 18301, checked in by Mathieu Morlighem, 11 years ago

merged trunk-jpl and trunk for revision 18299

File size: 1.4 KB
Line 
1/*
2 * \file Contours.cpp
3 * \brief: Implementation of Contours class, derived from DataSet class.
4 */
5
6/*Headers: {{{*/
7#ifdef HAVE_CONFIG_H
8 #include <config.h>
9#else
10#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
11#endif
12
13#include "./Contours.h"
14#include "../shared/shared.h"
15#include "./Contour.h"
16
17using namespace std;
18/*}}}*/
19
20/*Object constructors and destructor*/
21Contours::Contours(){/*{{{*/
22 enum_type=ContoursEnum;
23 return;
24}
25/*}}}*/
26Contours::~Contours(){/*{{{*/
27 return;
28}
29/*}}}*/
30
31/*Numerics: */
32int ExpWrite(Contours* contours,char* domainname){/*{{{*/
33
34 /*I/O: */
35 FILE* fid=NULL;
36 Contour<double>* contour = NULL;
37
38 /*open domain outline file for writing: */
39 if((fid=fopen(domainname,"w"))==NULL) _error_("could not open domain file " << domainname);
40
41 for(int counter=0;counter<contours->Size();counter++){
42 contour=(Contour<double>*)contours->GetObjectByOffset(counter);
43
44 /*Write header: */
45 fprintf(fid,"## Name:%s\n",domainname);
46 fprintf(fid,"## Icon:0\n");
47 fprintf(fid,"# Points Count Value\n");
48 fprintf(fid,"%u %s\n",contour->nods ,"1.");
49 fprintf(fid,"# X pos Y pos\n");
50
51 /*Write vertices: */
52 for(int i=0;i<contour->nods;i++){
53 fprintf(fid,"%lf\t%lf\n",contour->x[i],contour->y[i]);
54 }
55
56 /*Write blank line: */
57 if(counter<contours->Size()-1) fprintf(fid,"\n");
58 }
59
60 /*close Exp file: */
61 fclose(fid);
62
63 return 1;
64}/*}}}*/
Note: See TracBrowser for help on using the repository browser.