georadar
Народ для вас это должно быть неочень сложно!!!
Подскажите по программе а именно:
1)какой именно участок кода в Делфи отвечает за связь с Фортраном
2)Описать некоторые фрагменты кода что за что отвечает
3)представьте, что посторонний человек запускает эту программу -
что ему делать, по пунктам, и что при этом должно происходить на
экране (и, желательно, что при этом делается внутри программы)
ВОТ ЛИСТИНГ ПРОГРАММЫ:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, Series, Grids;
const
arraynumt = 2000;
arraynumy = 1000;
type
emf=array[0..arraynumt] of double; //новый тип - массив по времени
TEps=array[1..9] of double; //массив для эпсилон
TForm1 = class(TForm)
Chart1: TChart; //эта компонента - для рисования
Series1: TFastLineSeries;
GroupBox1: TGroupBox;
Label1: TLabel;
Label3: TLabel;
Label2: TLabel;
Edit1: TEdit;
Button1: TButton;
Edit2: TEdit;
Edit3: TEdit;
GroupBox3: TGroupBox;
StringGrid1: TStringGrid;
GroupBox2: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure getDataFromForm();
procedure checkData();
procedure putDataToForm();
private
{ Private declarations }
public
{ Public declarations }
end;
procedure getimpprop(E0,delta,omega,dt,ymax,s igouble; eps,EpsTh:TEps; e:emf); stdcall;
var //переменные
Form1: TForm1;
E0,delta,omega,str,dt,ymax,sigoub le;
e:emf;
eps,EpsTh:TEps;
i,j:integer;
PersCount,zuouble;
flWrongData:boolean;
implementation
{$R *.dfm}
//процедура, импортируемая из динамической библиотеки georadar.dll
procedure getimpprop(E0,delta,omega,dt,ymax,s ig ouble; eps,EpsTh:TEps;
e:emf);
external 'georadar1.dll';
//конструктор
procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[1,0] := 'Эпсилон';
StringGrid1.Cells[2,0] := 'Толщина в %';
for i:=1 to 9 do
begin
StringGrid1.Cells[0,i]:=FloatToStr(i);
StringGrid1.Cells[1,i]:=FloatToStr(0);
StringGrid1.Cells[2,i]:=FloatToStr(0);
end;
StringGrid1.Cells[1,1]:=FloatToStr(6);
StringGrid1.Cells[2,1]:=FloatToStr(1);
StringGrid1.Cells[1,2]:=FloatToStr(13);
StringGrid1.Cells[2,2]:=FloatToStr(1);
getDataFromForm();
end;
procedure TForm1.getDataFromForm();
begin
E0:=StrToFloat(Edit1.Text);
omega:=StrToFloat(Edit2.Text);
delta:=StrToFloat(Edit3.Text);
dt:=StrToFloat(Edit4.Text);
ymax:=StrToFloat(Edit5.Text);
sig:=StrToFloat(Edit6.Text);
end;
procedure TForm1.checkData();
begin
if delta<0 then
begin
showmessage('delta must be > 0');
flWrongData:=true;
end;
if omega<0 then
begin
showmessage('delta must be < 0');
flWrongData:=true;
end;
i:=1; PersCount:=0;
while ((TryStrToFloat(StringGrid1.Cells[2,i],zu)) or (i<10)) do
begin
PersCount:=PersCount+zu;
i:=i+1;
end;
if (PersCount<>100) then
begin
for j:=1 to i do
begin
TryStrToFloat(StringGrid1.Cells[2,j],zu);
StringGrid1.Cells[2,j]:=FloatToStr(zu*100/PersCount);
end;
end;
for i:=1 to 9 do
begin
TryStrToFloat(StringGrid1.Cells[1,i],zu);
eps[i]:=zu;
TryStrToFloat(StringGrid1.Cells[2,i],zu);
EpsTh[i]:=zu;
end;
end;
procedure TForm1.putDataToForm();
begin
Chart1.Series[0].Clear;
Chart1.Series[0].AddArray(e);
end;
//при нажатии на кнопку
procedure TForm1.Button1Click(Sender: TObject);
begin
getDataFromForm();
checkData();
if flWrongData then exit;
//передаем параметры в динамическую библиотеку и считаем поле
getimpprop(E0,delta,omega,dt,ymax,s ig,eps,EpsTh,e);
putDataToForm();
// StringGrid1.RowCount := 100;
//рисуем то, что получилось
end;
end.
|