Index: /issm/trunk-jpl/src/c/objects/Contour.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Contour.cpp	(revision 11886)
+++ /issm/trunk-jpl/src/c/objects/Contour.cpp	(revision 11887)
@@ -13,12 +13,149 @@
 #include "../io/io.h"
 
-void ContourEcho(Contour* contour){
+/*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_(true,"Number of nodes in contour: %i\n",contour->nods);
-	_printf_(true,"Node coordinates: \n");
-	for (i=0;i<contour->nods;i++){
-		_printf_(true,"%lf %lf\n",*(contour->x+i),*(contour->y+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;i<nods;i++){
+			printf("%i: %g|%g\n",i,x[i],y[i]);
+		}
 	}
 }
+/*}}}*/
+/*FUNCTION Contour::DeepEcho(){{{1*/
+void Contour::DeepEcho(void){
+	this->Echo();
+}
+/*}}}*/
+/*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; 
+}
+/*}}}*/
+#ifdef _SERIAL_
+/*FUNCTION Contour::Marshall{{{1*/
+void  Contour::Marshall(char** pmarshalled_dataset){
+
+	char* marshalled_dataset=NULL;
+	int   enum_type=0;
+	char* marshalled_inputs=NULL;
+	int   marshalled_inputssize;
+
+	/*recover marshalled_dataset: */
+	marshalled_dataset=*pmarshalled_dataset;
+
+	/*get enum type of Contour: */
+	enum_type=ContourEnum;
+	
+	/*marshall enum: */
+	memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
+	
+	/*marshall Contour data: */
+	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(marshalled_dataset,&nods,sizeof(nods));marshalled_dataset+=sizeof(nods);
+	memcpy(marshalled_dataset,&closed,sizeof(closed));marshalled_dataset+=sizeof(closed);
+	memcpy(marshalled_dataset,x,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+	memcpy(marshalled_dataset,y,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+
+	*pmarshalled_dataset=marshalled_dataset;
+	return;
+}
+/*}}}*/
+/*FUNCTION Contour::MarshallSize{{{1*/
+int   Contour::MarshallSize(){
+
+	return sizeof(id)+
+		sizeof(nods)+
+		sizeof(closed)+
+		2*nods*sizeof(double)+
+		sizeof(int); //sizeof(int) for enum type
+}
+/*}}}*/
+/*FUNCTION Contour::Demarshall{{{1*/
+void  Contour::Demarshall(char** pmarshalled_dataset){
+
+	char* marshalled_dataset=NULL;
+
+	/*recover marshalled_dataset: */
+	marshalled_dataset=*pmarshalled_dataset;
+
+	/*this time, no need to get enum type, the pointer directly points to the beginning of the 
+	 *object data (thanks to DataSet::Demarshall):*/
+
+	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(&nods,marshalled_dataset,sizeof(nods));marshalled_dataset+=sizeof(nods);
+	memcpy(&closed,marshalled_dataset,sizeof(closed));marshalled_dataset+=sizeof(closed);
+
+	if(nods){
+		this->x=(double*)xmalloc(nods*sizeof(double));
+		this->y=(double*)xmalloc(nods*sizeof(double));
+		memcpy(x,marshalled_dataset,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+		memcpy(y,marshalled_dataset,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+	}
+
+	/*return: */
+	*pmarshalled_dataset=marshalled_dataset;
+	return;
+}
+/*}}}*/
+#endif
+/*FUNCTION Contour::ObjectEnum{{{1*/
+int Contour::ObjectEnum(void){
+
+	return ContourEnum;
+
+}
+/*}}}*/
+/*FUNCTION Contour::copy {{{1*/
+Object* Contour::copy() {
+
+	return new Contour(*this); 
+
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/objects/Contour.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Contour.h	(revision 11886)
+++ /issm/trunk-jpl/src/c/objects/Contour.h	(revision 11887)
@@ -1,5 +1,4 @@
-/*! \file Contour.h
- *  \brief structure object to hold contour profiles from an 
- *  Argus domain outline file, or from any cad system.
+/*!\file Contour.h
+ * \brief: header file for Contour object
  */
 
@@ -7,13 +6,43 @@
 #define _CONTOUR_H_
 
-/*!Contour declaration: */
-struct Contour {
-	int	nods;
-	double* x;
-	double* y;
+/*Headers:*/
+/*{{{1*/
+#include "./Object.h"
+#include "../shared/Exceptions/exceptions.h"
+#include "../toolkits/toolkits.h"
+#include "../include/include.h"
+/*}}}*/
+
+class Contour: public Object{
+
+	public: 
+
+		int     id;
+		int	    nods;  //number of vertices in the contour
+		double* x;
+		double* y;
+		bool    closed; //is this contour closed?
+
+		/*Contour constructors, destructors {{{1*/
+		Contour();
+		Contour(int id, int nods, double* x, double* y,bool closed);
+		~Contour();
+		/*}}}*/
+		/*Object virtual functions{{{1*/
+		void  Echo(void);
+		void  DeepEcho(void);
+		int   Id(void);
+		int   MyRank(void);
+		#ifdef _SERIAL_
+		void  Marshall(char** pmarshalled_dataset);
+		int   MarshallSize(void);
+		void  Demarshall(char** pmarshalled_dataset);
+		#endif
+		int   ObjectEnum(void);
+		Object* copy(void);
+		/*}}}*/
+
+
 };
 
-/*!Methods: */
-void ContourEcho(Contour* contour);
-
-#endif  /* CONTOUR_H_ */
+#endif  /* _CONTOUR_H_ */
