1 | /*! \file Contour.c
|
---|
2 | * \sa Contour.h
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifdef HAVE_CONFIG_H
|
---|
6 | #include <config.h>
|
---|
7 | #else
|
---|
8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #include "./objects.h"
|
---|
12 | #include "../include/include.h"
|
---|
13 | #include "../io/io.h"
|
---|
14 |
|
---|
15 | /*Contour constructors and destructors:*/
|
---|
16 | /*FUNCTION Contour::Contour() default constructor {{{1*/
|
---|
17 | Contour::Contour(){
|
---|
18 | this->id=0;
|
---|
19 | this->nods=0;
|
---|
20 | this->x=NULL;
|
---|
21 | this->y=NULL;
|
---|
22 | this->closed=false;
|
---|
23 | }
|
---|
24 | /*}}}*/
|
---|
25 | /*FUNCTION Contour::Contour(int pid, int nods, double* x, double* y,bool closed) {{{1*/
|
---|
26 | Contour::Contour(int pid,int pnods, double* px, double* py,bool pclosed){
|
---|
27 |
|
---|
28 | this->id=pid;
|
---|
29 | this->nods=pnods;
|
---|
30 | this->closed=pclosed;
|
---|
31 | if(nods){
|
---|
32 | this->x=(double*)xmalloc(nods*sizeof(double));
|
---|
33 | memcpy(this->x,px,nods*sizeof(double));
|
---|
34 | this->y=(double*)xmalloc(nods*sizeof(double));
|
---|
35 | memcpy(this->y,py,nods*sizeof(double));
|
---|
36 | }
|
---|
37 | }
|
---|
38 | /*}}}*/
|
---|
39 | /*FUNCTION Contour::Contour() default constructor {{{1*/
|
---|
40 | Contour::~Contour(){
|
---|
41 | xfree((void**)&this->x);
|
---|
42 | xfree((void**)&this->y);
|
---|
43 | }
|
---|
44 | /*}}}*/
|
---|
45 |
|
---|
46 |
|
---|
47 | /*Object virtual function resolutoin: */
|
---|
48 | /*FUNCTION Contour::Echo(){{{1*/
|
---|
49 | void Contour::Echo(void){
|
---|
50 |
|
---|
51 | int i;
|
---|
52 |
|
---|
53 | printf("Contour: %i:\n",id);
|
---|
54 | printf(" nods: %i\n",nods);
|
---|
55 | printf(" closed: %s\n",closed?"true":"false");
|
---|
56 | if(nods){
|
---|
57 | printf(" x,y:\n");
|
---|
58 | for(i=0;i<nods;i++){
|
---|
59 | printf("%i: %g|%g\n",i,x[i],y[i]);
|
---|
60 | }
|
---|
61 | }
|
---|
62 | }
|
---|
63 | /*}}}*/
|
---|
64 | /*FUNCTION Contour::DeepEcho(){{{1*/
|
---|
65 | void Contour::DeepEcho(void){
|
---|
66 | this->Echo();
|
---|
67 | }
|
---|
68 | /*}}}*/
|
---|
69 | /*FUNCTION Contour::Id(){{{1*/
|
---|
70 | int Contour::Id(void){
|
---|
71 | return id;
|
---|
72 | }
|
---|
73 | /*}}}*/
|
---|
74 | /*FUNCTION Contour::MyRank{{{1*/
|
---|
75 | int Contour::MyRank(void){
|
---|
76 | extern int my_rank;
|
---|
77 |
|
---|
78 | return my_rank;
|
---|
79 | }
|
---|
80 | /*}}}*/
|
---|
81 | /*FUNCTION Contour::ObjectEnum{{{1*/
|
---|
82 | int Contour::ObjectEnum(void){
|
---|
83 |
|
---|
84 | return ContourEnum;
|
---|
85 |
|
---|
86 | }
|
---|
87 | /*}}}*/
|
---|
88 | /*FUNCTION Contour::copy {{{1*/
|
---|
89 | Object* Contour::copy() {
|
---|
90 |
|
---|
91 | return new Contour(*this);
|
---|
92 |
|
---|
93 | }
|
---|
94 | /*}}}*/
|
---|