/*! \file Contour.c * \sa Contour.h */ #ifdef HAVE_CONFIG_H #include #else #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" #endif #include "./objects.h" #include "../include/include.h" #include "../io/io.h" /*Contour constructors and destructors:*/ /*FUNCTION Contour::Contour() default constructor {{{1*/ Contour::Contour(){ this->id=0; this->nods=0; this->x=NULL; this->y=NULL; this->closed=false; } /*}}}*/ /*FUNCTION Contour::Contour(int pid, int nods, double* x, double* y,bool closed) {{{1*/ Contour::Contour(int pid,int pnods, double* px, double* py,bool pclosed){ this->id=pid; this->nods=pnods; this->closed=pclosed; if(nods){ this->x=(double*)xmalloc(nods*sizeof(double)); memcpy(this->x,px,nods*sizeof(double)); this->y=(double*)xmalloc(nods*sizeof(double)); memcpy(this->y,py,nods*sizeof(double)); } } /*}}}*/ /*FUNCTION Contour::Contour() default constructor {{{1*/ Contour::~Contour(){ xfree((void**)&this->x); xfree((void**)&this->y); } /*}}}*/ /*Object virtual function resolutoin: */ /*FUNCTION Contour::Echo(){{{1*/ void Contour::Echo(void){ int i; printf("Contour: %i:\n",id); printf(" nods: %i\n",nods); printf(" closed: %s\n",closed?"true":"false"); if(nods){ printf(" x,y:\n"); for(i=0;iEcho(); } /*}}}*/ /*FUNCTION Contour::Id(){{{1*/ int Contour::Id(void){ return id; } /*}}}*/ /*FUNCTION Contour::MyRank{{{1*/ int Contour::MyRank(void){ extern int my_rank; return my_rank; } /*}}}*/ /*FUNCTION Contour::ObjectEnum{{{1*/ int Contour::ObjectEnum(void){ return ContourEnum; } /*}}}*/ /*FUNCTION Contour::copy {{{1*/ Object* Contour::copy() { return new Contour(*this); } /*}}}*/