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

Last change on this file since 16137 was 15396, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 15394

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*/
21/*FUNCTION Contours::Contours(){{{*/
22Contours::Contours(){
23 enum_type=ContoursEnum;
24 return;
25}
26/*}}}*/
27/*FUNCTION Contours::~Contours(){{{*/
28Contours::~Contours(){
29 return;
30}
31/*}}}*/
32
33/*Numerics: */
34int ExpWrite(Contours* contours,char* domainname){/*{{{*/
35
36 /*I/O: */
37 FILE* fid=NULL;
38 Contour<double>* contour = NULL;
39
40 /*open domain outline file for writing: */
41 if((fid=fopen(domainname,"w"))==NULL) _error_("could not open domain file " << domainname);
42
43 for(int counter=0;counter<contours->Size();counter++){
44 contour=(Contour<double>*)contours->GetObjectByOffset(counter);
45
46 /*Write header: */
47 fprintf(fid,"## Name:%s\n",domainname);
48 fprintf(fid,"## Icon:0\n");
49 fprintf(fid,"# Points Count Value\n");
50 fprintf(fid,"%u %s\n",contour->nods ,"1.");
51 fprintf(fid,"# X pos Y pos\n");
52
53 /*Write vertices: */
54 for(int i=0;i<contour->nods;i++){
55 fprintf(fid,"%lf\t%lf\n",contour->x[i],contour->y[i]);
56 }
57
58 /*Write blank line: */
59 if(counter<contours->Size()-1) fprintf(fid,"\n");
60 }
61
62 /*close Exp file: */
63 fclose(fid);
64
65 return 1;
66}/*}}}*/
Note: See TracBrowser for help on using the repository browser.