[15049] | 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*/
|
---|
[18301] | 21 | Contours::Contours(){/*{{{*/
|
---|
[15049] | 22 | enum_type=ContoursEnum;
|
---|
| 23 | return;
|
---|
| 24 | }
|
---|
| 25 | /*}}}*/
|
---|
[18301] | 26 | Contours::~Contours(){/*{{{*/
|
---|
[15049] | 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: */
|
---|
[25836] | 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;
|
---|
[15049] | 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");
|
---|
[25836] | 58 | counter++;
|
---|
[15049] | 59 | }
|
---|
| 60 |
|
---|
| 61 | /*close Exp file: */
|
---|
| 62 | fclose(fid);
|
---|
| 63 |
|
---|
| 64 | return 1;
|
---|
| 65 | }/*}}}*/
|
---|