-- test_pde_read_ucd.adb test several UCD files -- -- start with subscript 1..n_vertices etc. -- -- structure of UCD file -- n_vertices n_cells n_ndata n_cdata n_mdata -- nodes called vertices in this implementation -- vertex data x,y,z 4th optional vertex under node data -- vert(1..n_vertices).x .y .z -- cell data -- cell(1..n_cells).i .matl .ctyp .cvert(j) -- j=1..ctypn(ctyp) -- ctyp pt=1(1) line=2(2) tri=3(3) quad=4(4) -- tet=5(4) pyr=6(5) prism=7(6) hex=8(8) type number, vert -- node data is Dirchilet boundary values -- nodecomp nodes1 nodes2 nodes3 component names -- noden1 noden2 noden3 component lengths, sum is n_ndata -- dirchilet_bound(1..n_vertices) when n_ndata=1 -- fourth_dim(1..n_vertices) when n_ndata=2 -- cell_data is Neumann boundary values, outward normal positive -- cellcomp cells1, cells2, cells3 component names -- celln1 celln2 celln3 component lengths, sum is n_cdata -- neumann_bound(1..n_cells) when n_cdata=1 -- model_data is optional fourth dimension for vertices -- modelcomp models1 models2 models3 component names -- modeln1 modeln2 modeln3 component lengths, sum is n_mdata -- fourth_dim(1..n_vertices) when n_mdata=1 with Ada.Text_Io; use Ada.Text_Io; with Real_Arrays; use Real_Arrays; with Pde_Read_Ucd; use Pde_Read_Ucd; with Ada.Command_Line; procedure Test_Pde_Read_Ucd is File_Name1 : String := "pde_ucd1.inp"; File_Name : access String; Argc : Integer := Ada.Command_Line.Argument_Count; package Real_Io is new Float_Io(Real); use Real_Io; package Int_Io is new Integer_Io(Integer); use Int_Io; procedure Print_Values is begin Put_Line("N_Vertices="&Integer'Image(N_Vertices)); Put_Line("N_Cells="&Integer'Image(N_Cells)); Put_Line("N_Ndata="&Integer'Image(N_Ndata)); Put_Line("N_Cdata="&Integer'Image(N_Cdata)); Put_Line("N_Mdata="&Integer'Image(N_Mdata)); Put_Line("vertices = nodes"); for I in 1..N_Vertices loop Put(I); Put(Vert(I).X); Put(Vert(I).Y); Put(Vert(I).Z); New_Line; end loop; -- end vertices Put_Line("cells"); for I in 1..N_Cells loop Put(Cell(I).I); Put(Cell(I).Matl); Put(Cell(I).Ctyp); Put("="); Put(Ctyps(Cell(I).Ctyp)); New_Line; for J in 1..Ctypn(Cell(I).Ctyp) loop Put(Cell(I).Cvert(J)); end loop; New_Line; end loop; -- end cells if N_Ndata=1 then Put_Line("node data, Dirchilet Bound"); elsif N_Ndata=2 then Put_Line("node data, Dirchilet Bound, 4th dimension coordinate"); end if; If N_Ndata>0 then for I in 1..N_Vertices loop Put(I); Put(Dirchilet_Bound(I)); if N_Ndata=2 then Put(Fourth_Dim(I)); end if; New_Line; end Loop; end if; -- end node data Put_Line("cell data, Neumann Bound"); If N_Cdata>0 then for I in 1..N_Cells loop Put(I); Put(Neumann_Bound(I)); New_Line; end Loop; end if; -- end cell data Put_Line("model data, optional fourth dimension"); If N_Mdata>0 then for I in 1..N_vertices loop Put(I); Put(Fourth_Dim(I)); New_Line; end Loop; end if; -- end model data end Print_Values; begin Put_Line("test_pde_read_ucd.adb running"); if Argc>0 then File_Name := new String'(Ada.Command_Line.Argument(1)); else File_Name := new String'(File_Name1); end if; Pde_Read_Ucd_File(File_Name.all); Put_Line("values read from file: "&File_Name.all); Print_Values; New_Line; Put_Line("test_pde_read_ucd.adb finished"); end Test_Pde_Read_Ucd;