C umBau.f program to keep running total of deflections and change C Bauschinger's data points to create a plotable file. SAVE C Compile: gfortran -g -w -fbounds-check umBau.f -o umBau C Usage: umBau plotableFile (both text) C Copyright (C) 2014 A.Conle C This file is free software; you can redistribute it and/or modify C it under the terms of the GNU General Public License as published by C the Free Software Foundation; either version 2 of the license, or (at C your option) any later version. C This file is distributed in the hope that it will be useful, but C WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- C BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public C License for more details. C You should have received a copy of the GNU General PUblic License along C with this program; if not, write to the Free Software Foundation, Inc., C 59 Temple Place -Suite 330, Boston, MA 02111-1307, USA. Try also their C web site: http://www.gnu.org/copyleft/gpl.html C Program look for " 0 0 X" lines in data and then adds the C "X" deflection values to all subsequent deflections in file. C Comment lines with a # in first col are printed out. C Blank lines are also printed (Gnuplot can use them to prevent C joining two points with a line) C character*300 inp300,jnp300 ! used to read in lines as chars. character*1 inpone(300),jnpone(300) character*10 inpten(30) equivalence (inpone(1), inpten(1), inp300) equivalence (jnpone(1),jnp300) integer*4 lastloc !used to output comment lines C character*80 argv C integer*4 iargc,nargc totadd=0.0 ! running total deflection added to current data 184 continue write(6,185) write(0,185) 185 format("#umBau.f vers. 1.0"/ & "#Usage: umBau outfile"/) ninput=0 nloads=0 900 continue !Loop back to here for next input line. read(5,"(a300)",end=950)inp300 ninput=ninput+1 C write(0,*)ninput if(inp300.eq." ")then ! Check for blank line C Yes it is a blank. Controls Gnuplot a bit. Put it out write(6,"(a1)")" " go to 900 endif if(inpone(1).ne."#")then C We may have a data line, or someone screwed up and put the # later in line. C See if 1st char is a # later in line do 905 i=1,300 if(inpone(i).eq." ") go to 905 C No? 1st non-blank found, if # its not a data line loc=i if(inpone(i).eq."#") then C A "#" comment line that does not start in 1st col. is ignored. go to 900 ! get next line else C The first non blank is not a # go to 910 endif 905 continue go to 900 !line contains only spaces. Abandon it, get next line 910 continue C 1st non blank is not a # Check if its a number. if(inpone(loc).ne."+" .and. & inpone(loc).ne."-" .and. & inpone(loc).ne."." .and. & inpone(loc).ne."0" .and. & inpone(loc).ne."1" .and. & inpone(loc).ne."2" .and. & inpone(loc).ne."3" .and. & inpone(loc).ne."4" .and. & inpone(loc).ne."5" .and. & inpone(loc).ne."6" .and. & inpone(loc).ne."7" .and. & inpone(loc).ne."8" .and. & inpone(loc).ne."9" )then C It must be a letter, not a number. Time to bomb out. write(0,915)ninput write(6,915)ninput 915 format(" ERROR stdin: input line no. ",I5, & " not a # and not a number. Fix data in load history file") stop endif C Ok, its a number nloads=nloads+1 read(inp300,*,err=925)yLoad,xDeflect if(yLoad .eq. 0. .and. xDeflect .eq. 0.)then read(inp300,*,err=925)yLoad,xDeflect,addDeflect totadd=totadd+addDeflect endif xout=xDeflect+totadd write(6,917)yLoad,xout,xDeflect 917 format(f7.2,1x,f7.2,1x,f7.2) go to 900 925 write(0,926)ninput,inp300 write(6,926)ninput,inp300 926 format("#READ ERROR: inputfile: line no.= ",i9/ & "#LINE= ",a300/ "# Stopping now.") stop endif 930 continue C Yes, first char was a # C All comment lines are just written out, or deleted C Write out the comment line C Count backwards and see where the last char is do 960 i=1,300 j=300-(i-1) if(inpone(j).ne." ")then C found last char lastloc=j go to 962 endif 960 continue 962 continue write(6,"(300a1)")(inpone(i),i=1,lastloc) C Go read another line go to 900 950 continue ! end of file comes here -------------------------- if(nloads.eq.0)then write(6,951) write(0,951) 951 format("#Error: inputfile contains no data !") stop endif C All data is in. stop end