⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 print_input_data.m

📁 matlab实例
💻 M
字号:
%***********************************************************************
%  function print_input_data
%
%  echo input data
%***********************************************************************
function print_input_data(Geom, BCs)

% data file title
fprintf ('\n<<<<---- Data File Echo ---->>>>\n\nTITLE - %s\n',Geom.title)

% node coordinates
fprintf ('NODES - # of nodes: %i; # of dimensions: %i\n',Geom.nnodes,Geom.dim)
disp ('  #      ID                x                 y              z')
for i = 1:Geom.nnodes
  fprintf ('%3i    ',i, Geom.Nodes(i).nodeID )
  for j = 1:Geom.dim
    fprintf('%14.5g',Geom.Nodes(i).coord(j))
  end
  fprintf('\n')
end

% element connectivity
fprintf ('ELEMENTS - # of elements: %i\n',Geom.nelems)
disp ('  #     ID   elemType   propID   connectivity')
elemType = 'voidElem';
for iel = 1:Geom.nelems
    if Geom.ElemData(iel).elemType == Geom.ETags.spring1d
        elemType = 'spring1d';
    elseif Geom.ElemData(iel).elemType == Geom.ETags.truss2d 
        elemType = 'truss2d';
    elseif Geom.ElemData(iel).elemType == Geom.ETags.pBar2
        elemType = 'pBar2';
    elseif Geom.ElemData(iel).elemType == Geom.ETags.pBar3
        elemType = 'pBar3';
    elseif Geom.ElemData(iel).elemType == Geom.ETags.pBar4
        elemType = 'pBar4';
    elseif Geom.ElemData(iel).elemType == Geom.ETags.pBar5
        elemType = 'pBar5';
    else
        disp('print_input_data: Invalid element type found. ');
        elemType
        continue;
    end
  fprintf('%3i %5i    %s %8i',i, Geom.ElemData(iel).elemID, elemType, Geom.ElemData(iel).propID)
  for j = 1:Geom.ElemType( Geom.ElemData(iel).elemType ).nnodes
    fprintf('%9i',Geom.ElemData(iel).connect(j))
  end
  fprintf('\n')
end

% element properties
fprintf ('PROPERTIES - # of properties: %i\n',Geom.nprops)
disp ( '  #   ID     propType         properties')
for i = 1:Geom.nprops
  fprintf('%3i  %3i    %s',i, Geom.Prop(i).propID, Geom.Prop(i).propType )
  if ( strcmpi( Geom.Prop(i).propType, 'MatSpring' ) | ...
       strcmpi( Geom.Prop(i).propType, 'MatTruss' )  | ...
       strcmpi( Geom.Prop(i).propType, 'MatpBar' ) )
    fprintf('%14.5g', Geom.Prop(i).properties )
    fprintf('\n')
  else
    disp('print_input_data: Invalid property type found. ');  
  end 
end 

% Node constraints
fprintf ('CONSTRAINTS - # of constraints: %i\n',BCs.nnodeConstraint)
disp ('  #       nodeID    dof     value')
for i = 1:BCs.nnodeConstraint
  fprintf('%3i %9i %9i %14.5g\n',i,BCs.NodeConstraint(i).nodeID, BCs.NodeConstraint(i).dof, BCs.NodeConstraint(i).value)
end

% loads
fprintf ('LOADS - # of loads: %i\n',BCs.npointLoads)
disp ('  #       nodeID    dof     value')
for i = 1:BCs.npointLoads
  fprintf('%3i %9i %9i %14.5g\n',i,BCs.PointLoad(i).nodeID, BCs.PointLoad(i).dof, BCs.PointLoad(i).value)
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -