#include <stdio.h>
#include <strings.h>
struct {
int nh1, nh2, nh3;
} hdata_;
struct {
int ior, iow;
} iofile_;
void inpt13(double *d) {
/*
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
c Input routine
c
c Material Properties:
c d[0] Lambda
lame parameter
c d[1] Shear
modulus
c d[2] relaxation
time
c d[3] Viscous
shear modulus
c d[10] Number
of history variables per gauss point
c-------------------------------------------------------
*/
int tinput_(); /*
Declare the FORTRAN input routine */
int errck,ntx,ntd;
char text[15]; /*
Due to the incompatibility of multidimensional
array indexing in C and Fortran
using a double index 'text' variable
is not recommended; though if you're clever it can be done.*/
double td;
char iow_str[1600];
int len;
/* These are really
just dummy variables for their parameters so that we can
generate pointers to the values which will then be passed to tinput_()
*/
ntx = 1;
/* number of strings to be read */
ntd = 1;
/* number of strings to be numbers */
strcpy(text,"xxxx");
while(strncmp(text," ",4) != 0) {
errck = tinput_(text,&ntx,&td,&ntd); /* Call FEAP's FORTRAN input routine (with pointers for all arguments */
if (strncmp(text,"lambda",6) == 0) d[0] = td;
if (strncmp(text,"mu",2) == 0) d[1] = td;
if (strncmp(text,"tau",3) == 0) d[2] = td;
if (strncmp(text,"stren",5) == 0) d[3] = td;
}
hdata_.nh1 = 6*4; /*
Set the number of history variables for the element */
d[10] = 6;
/*
c To
output to iow first write the string to a char
c array
then use the fortran cover function fortiow_()
c
This is the simplest way to deal with the fact that one
c
can not access FORTRAN stream numbers from C
c
and vice-versa
*/
/* First use sprintf()
to write the output into iow_str[] and get its length */
len = sprintf(iow_str," \
Lambda Parameter
= %12.5e\n \
Shear Modulus
= %12.5e\n \
Relaxation Time
= %12.5e\n \
Viscous Shear Mod
= %12.5e\n",d[0],d[1],d[2],d[3]);
/* Second use the
cover function fortiow_() to write out the string to the FORTRAN unit
iow */
fortiow_(iow_str,&len);
if(iofile_.ior < 0) printf("%s\n",iow_str);
}