Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting C code into Fortran

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have got a sample C code something like this. Please
let me know how to convert this small portion
of C code into Fortran.
Reply me back at pavan_jp@yahoo.com

Thanks in advance.
Pavan
------------------------------------------------------
#define X 0
#define Y 1
#define Z 2

typedef struct tVertexStructure tsVertex;
typedef tsVertex *tVertex;

typedef struct tEdgeStructure tsEdge;
typedef tsEdge *tEdge;

typedef struct tFaceStructure tsFace;
typedef tsFace *tFace;

struct tVertexStructure {
int v[3];
int vnum;
tEdge duplicate;
tVertex next, prev;
};

struct tEdgeStructure {
tFace adjface[2];
tVertex endpts[2];
tFace newface;
tEdge next, prev;
};

struct tFaceStructure {
tEdge edge[3];
tVertex vertex[3];
tFace next, prev;
};


int Normz( tFace f )
{
tVertex a, b, c;

a = f->vertex[0];
b = f->vertex[1];
c = f->vertex[2];


return
( b->v[X] - a->v[X] ) * ( c->v[Y] - a->v[Y] ) -
( b->v[Y] - a->v[Y] ) * ( c->v[X] - a->v[X] );
}
--------------------------------------------------------------------



 
It is difficult to implement 3D model data
structure using Fortran 77 because there is
no pointer. Data structure must be simplified
by using array and index. But I don't think
it is preferable. I suggest to use both C and
Fortran for your case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top