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

Last change on this file since 25836 was 25836, checked in by Mathieu Morlighem, 4 years ago

merged trunk-jpl and trunk for revision 25834

File size: 1.3 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 int counter = 0;
41 for(Object* & object : contours->objects){
42 contour=(Contour<double>*)object;
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 counter++;
59 }
60
61 /*close Exp file: */
62 fclose(fid);
63
64 return 1;
65}/*}}}*/
Note: See TracBrowser for help on using the repository browser.