📄 mainfun_.htm
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML VERSION="2.0"><HEAD><!-- WEBMAGIC VERSION NUMBER="2.0.1" --><!-- WEBMAGIC TRANSLATION NAME="ServerRoot" SRC="/var/www/htdocs/" DST="/" --><!-- WEBMAGIC TRANSLATION NAME="ProjectRoot" SRC="./" DST="" --><TITLE>Main read-in functions</TITLE></HEAD><BODY><P><FONT SIZE="6">Main read-in functions for ABAQUStoMatlab</FONT></P><UL><LI><FONT SIZE="5"><A HREF="#file_reader" NAME="file_reader">file_reader</FONT></A> <LI><FONT SIZE="5"><A HREF="#read_float">read_float</FONT></A> <LI><FONT SIZE="5"><A HREF="#read_header">read_header</FONT></A> <LI><FONT SIZE="5"><A HREF="#read_integer">read_integer</FONT></A> <LI><FONT SIZE="5"><A HREF="#read_text">read_text</FONT></A> <LI><FONT SIZE="5"><A HREF="#skip_to_end">skip_to_end</FONT></A> </UL><HR><H3><FONT SIZE="5">function [cp_num,hard,a,cp]=<A NAME="file_reader">file_reader(infil); </FONT></A></H3><PRE>% This function find the length of the current record [m,n]=size(infil);char_zero=48;% cp_val is by default set to 1 for fullfield solutions, in the case of% a modified boundary layer formultion cp_val gets the value 2, and% if the model type is not known cp_val get the value 0;cp_val=1; if infil(1)=='c' cp_num=1; cp='ccp';elseif infil(1)=='d' cp_num=4; cp='dec';elseif infil(1)=='s' & infil(3)=='c' cp_num=2; cp='sec';elseif infil(1)=='s' & infil(3)=='b' cp_num=3; cp='seb';elseif infil(1)=='m' cp='mbl' cp_num=0; cp_val=2;else cp_val=0; cp_num=0; cp='udg'; 'undefined geometry'end % the hardening rates is determined in this section of the routineif cp_val==1 a=(abs(infil(5))-char_zero)*100; if infil(6)=='1' hard='13'; elseif infil(6)=='6' hard='06'; elseif infil(6)=='3' hard='03'; elseif infil(6)=='n' hard='nh'; else hard='unrecognised hardening rate'; end elseif cp_val==2 if infil(5)=='1' hard='13'; elseif infil(5)=='6' hard='06'; elseif infil(5)=='3' hard='03'; elseif infil(5)=='n' hard='nh'; else hard='unrecognised hardening rate'; endend 'the analysed crack problem is a :',cp 'and have a crack problem number :',cp_num 'the hardening rate is',hard 'the crack length is',a</PRE><HR><P><A HREF="#file_reader"><IMG SRC="up.gif" WIDTH="30" HEIGHT="30" SGI_FULLPATH="/tmp_mnt/home/mech7/annette/web-docs/ch10/program/up.gif"></A></P><H1><FONT SIZE="5">function [vector,status]=<A NAME="read_float">read_float</A>(fid);</FONT></H1><PRE> status=0; [numbers,len]=fscanf(fid,'D%e'); j=0; if (len/2-round(len/2)~=0) status=-1; 'uneven numbers in read_float, can not process' vector=0; else while j~=len j=j+2; vector(j/2)=numbers(j-1)*10^numbers(j); end, end, </PRE><HR><P><A HREF="#file_reader"><IMG SRC="up.gif" WIDTH="30" HEIGHT="30" SGI_FULLPATH="/tmp_mnt/home/mech7/annette/web-docs/ch10/program/up.gif"></A></P><P><FONT SIZE="5">function [nitems,label,status]=<A NAME="read_header">read_header</A>(fid);</FONT></P><PRE> status=0; [nitems,status]=read_integer(fid); if status==0 [label,status]=read_integer(fid); endend %function </PRE><P></P><HR><P><A HREF="#file_reader"><IMG SRC="up.gif" WIDTH="30" HEIGHT="30" SGI_FULLPATH="/tmp_mnt/home/mech7/annette/web-docs/ch10/program/up.gif"></A></P><P><FONT SIZE="5">function[i,status]=<A NAME="read_integer">read_integer</A>(fid);</FONT></P><PRE>status=0;[nchar,len]=fscanf(fid,'I%1d',1); if len~=1 'read_integer len~=1' status=-1; end[i,len]=fscanf(fid,'%d');</PRE><HR><P><A HREF="#file_reader"><IMG SRC="up.gif" WIDTH="30" HEIGHT="30" SGI_FULLPATH="/tmp_mnt/home/mech7/annette/web-docs/ch10/program/up.gif"></A></P><P><FONT SIZE="5">function [string,status]=<A NAME="read_text">read_text</A>(fid);</FONT></P><PRE>status=0;[string,len]=fscanf(fid,'A%8s',1);if length(string)<=1 string='NO_NAME';end </PRE><HR><P><A HREF="#file_reader"><IMG SRC="up.gif" WIDTH="30" HEIGHT="30" SGI_FULLPATH="/tmp_mnt/home/mech7/annette/web-docs/ch10/program/up.gif"></A></P><P><FONT SIZE="5">function [status] =<A NAME="skip_to_end">skip_to_end</A>(fid);</FONT></P><PRE> char=0; status=1; while char~='*' [char,len]=fscanf(fid,'%1s',1); if len~=1 status=-1; 'len is not 1 in skip_to end' end end </PRE><HR><P></P><P></P><P></P><P></P><P></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -