/* $Header: /usr/home/sanjay/Feap/Elem/Ec/RCS/elmt13.c,v 1.3 2000/01/28 20:23:59 sanjay Exp $ */

#include <stdio.h>

struct {
    int ior, iow;
} iofile_;
/* Named common blocks from the main program show up as structures in C */

/*  An underscore is used on all routines in C that interact with FORTRAN units this is compiler dependent;
       This includes C that is called by FORTRAN, FORTRAN that is call by C, and common blocks */

void elmt13_(double (* d), double (* ul), double (* xl),
             int    (* ix),double (* tl), double (* s ),
             double (* p ), int (* ndf), int (* ndm),
             int (* nst), int (* isw)) {
/* FORTRAN passes  in all arguments as pointers (ie. pass by location) */

/*
c--------------------------------------------------------------
c      * * F E A P * * A Finite Element Analysis Program
c      Copyright (c) 1984-2000: Robert L. Taylor
c
c      C Language Example Element for FEAP
c      Copyright (c) 2000     : Sanjay Govindjee
c--------------------------------------------------------------
*/
 

      switch(*isw) {  /* Main isw switch */

       case 0:

        if(iofile_.ior < 0) printf("   Elmt 13: Example C Element\n");  /* writing to standard out does not require any special consideration */
        break;

       case 1:  /* Input Material Properties */

        inpt13(d);
        break;

       case 2: /* Check Mesh for Errors */

        ckisop_(ix,xl,s,ndm); /* This a call to a FORTRAN routine from FEAP; note the underscore and the fact that all the arguments are pointers */
        break;

       case 3: /* Tangent plus residual */
       case 6: /* Residual only */
       case 4: /* Stress output */
       case 8: /* Plot output */

        stif13(d,ul,xl,ix,tl,s,p,*ndf,*ndm,*nst,*isw);
        break;

       default:
        break;
 

      }

}