Tuesday, November 14, 2006

My first OOP lines

After more than 2 years of C/C++ debugging, I finally needed object oriented programming too. Eventually the lines below will end up as a FDTD program to be run in CSRC. Syntax colors were rendered with SciTE. Remnants of old style programming could still be seen here by the way. I strongly believe that I would be laughing when I read these lines some day. Hopefully sooner.


#ifndef __FDTD_3D_HPP

#define __FDTD_3D_HPP
#include using namespace std;

/*********Vector Plane with vector components X Y Z************/
class
V3Plane{
public
:
int ASIZE; //array size
//data holders
float
*X;
float *Y;
float
*Z;
//operators
void set_size(int);
~V3Plane();
};

//allocate memory
void V3Plane::set_size(int isize){
ASIZE = isize;
isize = isize*sizeof(float);
X = (float *)malloc(isize);
Y = (float *)malloc(isize);
Z = (float *)malloc(isize);
}

//release memory

V3Plane::~V3Plane(){
free(X);
free(Y);
free(Z);
}

/******************core part of 3d FDTD******************/
void m3dfdtd(V3Plane z1, V3Plane z2, V3Plane z3){
/*Nothing yet...*/
}

#endif //__FDTD_3D_HPP

No comments: