NORMA (1158464), страница 6

Файл №1158464 NORMA (Раздаточные материалы) 6 страницаNORMA (1158464) страница 62019-09-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 6)

VARIABLE X DEFINED ON Ox. FOR OxII ASSUME X = F(Y) .

As we mentioned earlier functions may be included into arithmetical expression and scalar

arithmetical expression.

5.2.3. Function calls in Norma

call-function :

call-reduction-function

call-standard-function

call-external-function

call-reduction-function :

name-reduction-function ( ( name-domain )arithm-expression )

call-standard-function :

name-standard-function ( arithm-expression )

name-reduction-function :

{ SUM,MULT,MAX,MIN }

call-external-function :

name-external-function [ ( list-in-parameter ) ]

in-parameter :

arithm-expression

name-variable-on-domain ON domain-of -parameter

iterated-variable-on-domain ON domain-of-parameter

name-external-simple-part

name-external-function

domain-of-parameter :

name-unconditional-domain

name-unconditional-domain / index-expression

name-unconditional-domain / ( list-index-expression )

iterated-variable-on-domain :

name-variable-on-domain [ name-iteration-index [-1] ]

There are defined standard arithmetical functions, reduction functions and external user’s functions in the language.

5.2.3.1. Standard arithmetical functions

Functions: sqrt(x), abs(x), exp(x), alog(x), alog10(x), sin(x), cos(x), asin(x), atan(x), sign(x), dsqrt(x), dabs(x), dexp(x), dalog(x), dalog10(x), dsin(x), dcos(x), dasin(x), datan(x), dsign(x), entier(x), amax1(x,y,...), amin1(x,y,...), dmax1(x,y,...), dmin1(x,y,...), are standard functions.

These functions are analogous of a corresponding Fortran function.

5.2.3.2. Reduction functions

Functions: SUM (sum), MULT (multiplication), MAX (maximum), MIN (minimum) are reduction functions. Result of calcukation of these function is DOUBLE. Call to these functions :

name-function ( ( name-domain ) arithm-expression ).

Domain defines the number of domain’s point where the function will be computed, arithmetical expression defines the number of values which the function are applied to. Here is an example :

The fragment of this computation in NORMA :

Grid: (Oi: (I1..N) ; Oj: (J=1..M) ).

VARIABLE A DEFINED ON Grid.

VARIABLE V,W DEFINED ON Oi. VARIABLE X DEFINED ON Oj.

FOR Oi ASSUME V = W + SUM( ( OJ ) A*X) .

Here is an example of embeded reduction functions:

SurfaceMax:

(Left: (Three:(IV=1..3) ; A:(J=0..2*M);B:(I=0..2*N) );

Right: ( ( IK=1..9) ; (W=0..2*M) ; BNU:(NU=0..2*N) ) ).

SUMPOL:( (W=0..2*M) ;BNU).

ThreeAB:(Three;A;B). OLINE:(LINE=1..3).

VARIABLE VV,V DEFINED ON ThreeAB DOUBLE.

VARIABLE S DEFINED ON SurfaceMax DOUBLE.

FOR ThreeAB ASSUME

VV=SUM( (SUMPOL) SUM((OLINE)

V[IV=LINE] (V[IV=1] *S[IK=LINE]+V[IV=2]*S[IK=LINE+3]+V[IV=3]*S[IK=LINE+6]) ) ) .

The rule of index localization is true for reduction functions: domain declared as argument of reduction function has its own index system. The subject of this system action is arithmetical expression declared as the second argument of reduction function. It means that indexes used in the arithmetical expression may be divided into two types: “internal” which coincide with the indexes of the reduction domain and defined by them and “external” which don’t coincide with indexes of reduction domain and defined by external domains (e.g. domains of other reduction functions or ASSUME operator). The set of “internal” indexes values is completely defined by the domain set as an argument of reduction function. The set of “external” indexes values is defined by the domains which are external for reduction function.

E.g. operator

FOR Oik ASSUME X=(i+k) / SUM( (Oij5) B*C).

defines request for computation

if the declarations are :

Oij5 : ((i=1..5) ; (j=1..5)). Oik: (i=1..10) ; (k=1..10)).

Oijk: (Oij:((i=1..15) ; (j=1..15)) ;(k=1..15)).

VARIABLE B DEFINED ON Oijk. VARIABLE C DEFINED ON Oij.

VARIABLE X DEFINED ON Oik.

If external domain is conditional the condition acts on all the external indexes of arithmetical expression which are under the sign of reduction function. E.g. formula

sets computation

..............

may be written as :

Oij: (Oi: (i=1..10); Oj: (1..10)) . OiLTj:Oij / i<j.

OiLTjYLTO, OiLTjYGEO:OiLTj / Y<0.

Oi100: (i=1..100). Oij100: (Oi100;Oj).

VARIABLE B DEFINED ON Oij100. VARIABLE X DEFINED ON Oij.

VARIABLE Y DEFINED ON Oj.

FOR OiLTjYLTO ASSUME X=SUM( ( Oi100) B*Y).

Recursive computations are prohibited for the values used in both the left part of ASSUME operator and arithmetical expression in reduction function. E.g. formula

can not be represented in one ASSUME operator

FOR Oij ASSUME X = SUM ((Oij1)X).

5.2.3.3. User’s external functions

External function is defined by user. One can call this function by name, the list of actual parameters divided by comma is put into brackets and placed after the name. The result of function’s computations is represented by function’s name. If all the actual parameters have their values computation is available . All the actual parameters are considered initial data for function computation, side effect is prohibited.

Arithmetical expressions, part and function names or variables on domain (arrays) can be actual parameters of external function.

Here is an example of external function with different ways of actual parameters setting .

Grid: (Oi: (I=1..N) ; Oj: (J=1..M)).

VARIABLE A, B DEFINED ON Grid.

VARIABLE X,Y DEFINED ON Oi. VARIABLE T DEFINED ON Oj.

VARIABLE Gamma DOUBLE.

INPUT A,B ON Grid, Y ON Oi, T ON Oj. INPUT Gamma.

OUTPUT X ON Oi.

DOMAIN PARAMETERS N = 10, M = 20. EXTERNAL FUNCTION DxDy.

FOR Oi ASSUME

X = F(DxDy, Gamma+0.5*Y, T ON Oj, A ON Grid / (i=2..8,J=M-2), B ON Grid /J=I+2).

ASSUME operator set the rule of array Xi,i =1,10 computation. User’s function F with parameters values are to be computed for every i. The list of parameters :

1-st parameter - name DxDy of external user’s function;

2-nd parameter- arithmetical expression Gamma+0.5*Yi;

3-rd parameter - Tj, j=1,...,20 values of static array;

4-th parameter - Ai,j ,i=2,...,8, j=18 values of array’s section : one-dimensional array consists of the 2-8 rows elements from the 18th column of A matrix;

5-th parameter - Bi,j, i=1,...,10,j=i+2 of dynamic array’s section : i+2 column of B matrix.

The rules of formal and actual parameters correspondence :

  1. The number of actual and formal parameters must be equal; correspondence is set from the left to the right in writing order.

Formal parameter

Actual parameter

function name

function name

part name

part name

scalar

arithmetical expression

variable on domain

variable on domain

(3) If both formal and actual parameters are variables on domain then the number of domain indexes and the number of points in the ranges on corresponding indexes must be the same (5.1.2).

5.2.4. Part call

call-part :

COMPUTE name-part [ ( actual-parameters )]

actual-parameters :

[ list-in-parameter ] [ RESULT list-out-parameter ]

out-parameter :

name-scalar

name-variable-on-domain ON domain-of-parameter

iterated-variable-on-domain ON domain-of-parameter

Arithmetical expressions, part and function names or variables on domains (arrays) can be actual parameters.

Actual parameters may be declared as initial or results by key word RESULT.

E.g.:

COMPUTE Velocity ( Delta+0.5, Fi ON Oijk RESULT V ON Oij).

The first two parameters are initial, the third is result. Side effect is impossible: if sets of initial parameters and parameters-results intersect the result of intersection will be reassignment which is prohibited in NORMA.

Part call is a development of notion relation in ASSUME operator because it allows to obtain several results at once. Part call without ASSUME operator is a development of scalar operator notion.

The ways of part initial actual parameters setting and the ways of function actual parameters settings (5.2.3.3) are the same.

Scalars, variables with indexes (may be set by the rule of default indexes), variables on domains (arrays) may be actual parameters-results.

If part call is in the body of ASSUME operator then scalars and variables on static domain (which don’t change for different values of indexes from ASSUME header) can’t be parameters-values - it causes reassignment.

If part call isn’t in the body of ASSUME operator then scalar names, variables with index-constants and variables on static domains can be parameters-results only.

Part call in the part with declaration DISTRIBUTION INDEX is prohibited.

Here is an example of actual parameters settings in different ways .

VARIABLE A,B DEFINED ON Grid: (Oi: (I=1..N);Oj: (J=1..M) ).

VARIABLE X,Y DEFINED ON Oi. VARIABLE T DEFINED ON Oj.

VARIABLE Gamma DOUBLE.

INPUT A ON Grid ,Y ON Oi,T ON OJ. INPUT Gamma.

OUTPUT X ON Oi, B ON Grid /J=2..12.

DOMAIN PARAMETERS N =10, M =20.

EXTERNAL PART DzDy.

FOR Oi ASSUME

COMPUTE TEST ( DzDy, T ON Oj, Y RESULT X, B ON Grid /J=I+2).

COMPUTE SCALAR( A ON Grid RESULT Gamma, B ON Grid /J=2).

The rule of Xi,j, i=1,...,10 and part of matrix B : Bi,j, i=,...,10, j=3,...,12 computation is defined in ASSUME operator.

Scalar call of part SCALAR defines scalar Gamma and the second column of B matrix.

The rules of actual and formal parameters-results correspondence are the same as for correspondence rules for functions (5.2.3):

Formal parameter

Actual parameter

scalar

scalar

scalar

variable with index constant

variable on domain

variable on domain

5.2.5. Interface with FORTRAN programs

Subroutines and functions written in Fortran may be called from the program written in NORMA by usual tools of part and function call. Reassignment control is carried out in actual parameters analysis.

Характеристики

Список файлов учебной работы

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6508
Авторов
на СтудИзбе
302
Средний доход
с одного платного файла
Обучение Подробнее