Ice Sheet System Model  4.18
Code documentation
Contours.cpp
Go to the documentation of this file.
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 
17 using namespace std;
18 /*}}}*/
19 
20 /*Object constructors and destructor*/
22  enum_type=ContoursEnum;
23  return;
24 }
25 /*}}}*/
27  return;
28 }
29 /*}}}*/
30 
31 /*Numerics: */
32 int 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 }/*}}}*/
DataSet::Size
int Size()
Definition: DataSet.cpp:399
Contours
Declaration of Contours class.
Definition: Contours.h:10
Contours::Contours
Contours()
Definition: Contours.cpp:21
Contour
Definition: Contour.h:15
ExpWrite
int ExpWrite(Contours *contours, char *domainname)
Definition: Contours.cpp:32
Contours.h
ContoursEnum
@ ContoursEnum
Definition: EnumDefinitions.h:1016
Contour::nods
int nods
Definition: Contour.h:20
Contours::~Contours
~Contours()
Definition: Contours.cpp:26
Contour::y
doubletype * y
Definition: Contour.h:22
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
Contour::x
doubletype * x
Definition: Contour.h:21
Contour.h
: header file for Contour object