Polling Input

From FEAP Wiki
Revision as of 19:10, 12 February 2020 by S g (talk | contribs) (Created page with "== Polling Input == When writing input routines for user elements and user material models it is recommended to use a polling input model. The basic idea it to use a <code>do...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Polling Input

When writing input routines for user elements and user material models it is recommended to use a polling input model. The basic idea it to use a do while loop structure that reads your data based on keyword pairs, stores the values in ud(:), and then terminates its reading when it encounters a blank line or some other string that you designate as the termination condition for your input. Here is a template that you can follow:

     logical    pcomp,tinput,errck
     character  type*15,text(2)*15,termination*15
     real*8     ud(*),td(10)
       text(1) = 'start'
       termination = '     '  ! or for example 'my input end'
       do while (.not.pcomp(text(1),termination,4))
         errck = tinput(text,2,td,9)  ! Read two keywords and up to 9 values
         if (pcomp(text(1),'key1',4)) then
           if (pcomp(text(2),'key2',4)) then
             ud(1) = td(1)
             ud(2) = td(2)          
           elseif (pcomp(text(2),'key3',4)) then
             ud(3) = td(1)
           endif
         elseif (pcomp(text(1),'key4',4)) then
           if (pcomp(text(2),'key5',4)) then
             ud(4) = td(1)
             ud(5) = td(2)
             ud(6) = td(3)
           endif
         endif
       end do