PFC手册fish翻译中英文.讲义

PFC手册fish翻译中英文.讲义
PFC手册fish翻译中英文.讲义

2 FISH REFERENCE

2.1 Introduction and Overview

简介和概述

This section contains a detailed reference to the FISH language. Following the introduction, Section2.2 describes the rules of the language and how variables and functions are used. Section 2.3explains FISH statements and Section 2.4 describes how the FISH language links with PFC2D. Pre-defined FISH variables, functions and arrays are described in Section 2.5.

这部分包含FISH语言的详细参考。接下来,2.2描述语言规则及如何运用变量和函数。2.3解释FISH 陈述。2.4描述FISH语言如何与PFC联系在一起。2.5讲述如何预定义FISH变量、函数和数列。

FISH is a programming language embedded within PFC2D that enables the user to define new variables and functions. These functions may be used to extend PFC2D’s usefulness or add use r defined features. For example, new variables may be plotted or printed, special particle generators may be implemented, servo-control may be applied to a numerical test, unusual distributions of properties may be specified, and parameter studies may be automated.

FISH是PFC内置的一种编程语言,用户可以自定义变量和函数。这些函数可用来扩展PFC的功能,或者增加用户定义的特征。例如:输出或者打印新的变量、实现特殊的颗粒生成、数值测试中中应用伺服控制、定义特殊的颗粒分布以及自动研究参数。

FISH is a “compiler” (rather than an “interpreter”). Programs entered via a PFC2D data file are translated into a list of instructions (in “pseudo-code”) stored in PFC2D’s memory space; the original source program is not retained by PFC2D. Whenever a FISH function is invoked, its compiled pseudo-code is executed. The use of compiled code — rather than interpreted source code —enables programs to run much faster. However, unlike a compiler, variable names and values are available for printing at any time; values may be modified by the user by using PFC2D’s SET command.

FISH是一个编程员,而不是一个翻译员。通过PFC数据文件输入的程序转化成一连串命令(以“pseudo 指令”的形式)储存在PFC的存储空间。PFC没有保留初始源程序。无论何时援引FISH函数,其编好的pseudo 指令执行。编好的指令—不是翻译好的源指令—的作用是使得程序更快的运行。然而,不像编程员那样,FISH在任何时间都可以打印变量的名字和数值,用户可以通过PFC中的SET命令修改数值。

FISH programs are simply embedded in a normal PFC2D data file — lines following the word DEFINE are processed as a FISH function; the function terminates when the word END is encountered. Functions may invoke other functions, which may invoke others, and so on. The order in which functions are defined does not matter, as long as they are all defined before they are used (e.g., invoked by a PFC2D command). Since the compiled form of a FISH function is stored in PFC2D’s memory space, the SAVE command saves the function and the current values of associated variables.

FISH程序简单的包含在正常的PFC数据文件里—DIFINE 后边的命令行按FISH函数处理;函数以遇到END为结尾。函数也许会援引其他函数,其它函数亦会援引其他函数等等。函数定义的顺序没有影响。因为FISH函数的程序形式储存在PFC的存储空间,SAVE命令会存储函数及相关变量的当值。

A summary of FISH language and intrinsic names is provided in Section 2 in the Command and FISH Reference Summary.

在Command and FISH Reference Summary.的第二章提供FISH语言及其内在名字的总结。

2.2 FISH Language Rules, Variables and Functions

FISH语言规则,变量及函数

2.2.1 Lines 命令行

FISH programs can be embedded in a normal PFC2D data file or may be entered directly from the keyboard. Lines following the word DEFINE are taken to be statements of a FISH function; the function terminates when the word END is encountered. A valid line of FISH code must take one of the following forms.

FISH程序包含在普通的PFC数据文件中或者直接从键盘键入。DIFINE 后边的命令行按FISH函数处理;函数以遇到END为结尾。FISH的有效命令行必须是下述格式中的一种。

1. The line starts with a statement, such as IF, LOOP, etc. (see Section

2.3).

2. The line contains one or more names of user-defined FISH functions, separated

by spaces — e.g.,

fun 1 fun 2 fun 3

where the names correspond to functions written by the user. These functions

are executed in order. The functions need not be defined prior to their reference

on a line of FISH code (i.e., forward references are allowed).

3. The line consists of an assignment statement (i.e., the expression on the right

of the = sign is evaluated and the value given to the variable or function name

on the left of the = sign).

4. The line consists of a PFC2D command, provided that the line is embedded in a

section of FISH code delimited by the COMMAND –ENDCOMMAND statements

(see Section 2.3.3).

5. The line is blank or starts with a semicolon.

1.命令用IF,LOOP等开始。(见

2.3)

2.如果一行包含一个或更多用户定义FISH函数的名字,以空格号隔开。

例如fun_1 fun_2 fun_3

名字与用户所写的函数相对应,这些函数有序执行。一行FISH指令中,函数没有必要比其参考前定义。

(即允许参考在前面)

3.命令行包含指派声明(例如等号右边的数学式被运算且其值赋予给等号左边的函数名称或是变量)

4.命令行由PFC命令组成,通过COMMAND—ENDCOMMAND 分隔FISH 指令。命令行包含在FISH指令的一部分里面。

5.命令行以分号开始或者结束。

FISH variables, function names and statements must be spelled out in full; they cannot be truncated, as in PFC2D commands. No continuation lines are allowed; intermediate variables may be used to split complex expressions. FISH is “case-insensitive” by default — i.e., it makes no distinction between upper case and lowercase letters; all names are converted to lowercase letters. (Note that this can be changed with the command SET case sensitivity on.) Spaces are significant (unlike inFORTRAN) and serve to separate variables, keywords, and so on; no embedded blanks are allowed in variable or function names. Extra spaces may be used to improve readability—for example, by indenting loops and conditional clauses. Any characters following a semicolon ( ; ) are ignored; comments may be embedded in a FISH program by preceding them with a semicolon. Blank lines may be embedded in a FISH program.

函数的变量,函数名称或者声明必须完整拼写,在PFC命令中不能缩写。不允许有连续的命令行;可以利用中间变量分解复杂的表示式。FISH在默认状态下为“对情况不敏感”—即大写与小写字母之间没有区别,所有的名字都转换为小写字母(注意可以通过(SET case sensitivity on)命令改变)。有相当大的空间来存储各自的变量、关键词等等(与FORTRAN不同)。在变量或是函数名中不允许含有空格。还留有格外的空间来提高可读性--例如通过缩进循环或是假定子句。分号后面的所有字都被忽略;FISH程序中包含的注释放在分号后面;FISH程序中可以包含空白行。

2.2.2 Reserved Names for Functions and Variables

为函数和变量保留的名字

Variable or function names must start with a non-number and must not contain any of the following symbols:

. , * / + - ? = < > # ( ) [ ] @ ; ’ "

变量或函数名必须以非数字开始,并且不包含下列符号:. , * / + - ? = < > # ( ) [ ] @ ; ’ "

User-defined names can be any length, but they are truncated in printout and in plot captions, due to line-length limitations. In general, names may be chosen arbitrarily, although they must not be the same as a FISH statement (see Section 2.3) or a pre-defined variable or function (see Section 2.5). There are also many other words used in PFC2D input that should be avoided. The list contained in Table 2.1 shows all words that could give rise to a conflict if used to name a FISH variable or function. However, the potential conflict depends on the way in which the chosen name is used. For example, the word gravity could be used as a FISH variable, provided that it is simply referred to inside a FISH function; conflict would arise only if it is necessary to use the SET command to set its value, since gravity is a valid argument to the SET command. Similarly, it may be impossible to print the value of a FISH variable if its name is the same as a parameter for

the PRINT command. If in doubt, avoid any of the names listed in Table 2.1, or contractions of the names (since PFC2D allows of keywords and commands).

用户定义的名字可以在任何长度,但是由于行的长度限制,在打印或输出加标题时会被截断。一般说来,名字是任意选择的,只要与FISH参数或者预先定义的变量或函数不同就行,还应避免PFC输入时将要用的的词。表2.1列出的词,如果用来命名FISH变量或函数,便会引起冲突。但是,潜在的冲突决定于如何利用所选中的名字。例如:gravity可以用作FISH变量,只是简单的在FISH函数内部涉及。只有当用SET命令去设置它的值,冲突才会发生,因为对于SET命令来说,gravity是个有效的词语。类似的,当一个FISH变量的名字与PRINT命令的参数一样时,也不可能把这个变量的值打印出来。如果有疑问,避免表2.1中的所有词,或者缩写名字。(因为PFC允许关键词或者命令缩写)

As an alternative strategy, the PFC2D command SET safe conversion can be used to force the explicit recognition of FISH variables in a command-line instruction. The @ symbol

pre-pended to any FISH variable identifies the object as such and forces the command-line parser to ignore any other possible interpretation. For example, suppose that a FISH function initial, as shown in Example 2.1, has been created. Attempting to run the function from the command prompt would ordinarily produce an error, since the command INITIAL would take precedence over the FISH initial. However, using the FISH identifier@in front of the variable gives us an unambiguous, correct interpretation.

作为一个相对的策略,可以用PFC中的命令SET safe conversion 强制FISH变量清晰的组织成为命令行说明。@置于任何FISH变量之前都表示照这样鉴定这个对象,强制命令行的语法分析器忽略任何其他可能的解释。例如:假定例2.1中的FISH函数initial 已经创建。试图从命令提示中运行这个函数一般会引起错误。但是,在变量前面使用函数标识符@,便会得到一个明白的,正确的解释。

Example 2.1 Explicit identification of FISH variables

;fname: fishr1.dat

def initial

xvel = 0.0

yvel = 1.0

end

;

; these lines will both result in errors... 这两行均会引起错误

initial ; ... vainly hoping to initialize parameters... 欲将参数初始化

ini xvel xvel yvel yvel ; ...obviously ambiguous... 明显的混乱

;

; these lines would solve the problem... 这些命令行将解决问题

set safe_conversion on

@initial

ini xvel @xvel yvel @yvel

By default, user-defined variables represent single numbers or strings. Multi-dimensional arrays of numbers or strings may be stored if the ARRAY statement is used. Section 2.3.1 defines the way in which arrays are created and used. At present, there is no explicit printout or input facility

for arrays, but functions may be written in FISH to perform these operations. For example, the contents of a two-dimensional array (or matrix) may be initialized and printed, as shown in Example 2.2.

默认状态下,用户自定义的变量只能代表单个数字或是字符串。如果使用ARRAY才能储存数字或字符串的多维数组。2.3.1定义了数组的创建和使用方法。目前,没有明确的数组输入或输出设备,但是可以在FISH中写函数执行这些操作。例如:如例2.2所示,可以初始化和打印二位数组(或矩阵)的内容。

Example 2.2 Initializing and printing FISH arrays

;fname: fishr2.dat

new

def afill ; fill matrix with random numbers 用任意数字填满矩阵

array var(4,3)

loop m (1,4)

loop n (1,3)

var(m,n) = urand

end_loop

end_loop

end

def ashow ; display contents of matrix 展示矩阵内容

loop m (1,4)

hed = ’ ’

msg = ’ ’+string(m)

loop n (1,3)

hed = hed + ’ ’+string(n)

msg = msg + ’ ’+stri ng(var(m,n))

end_loop

if m = 1

dum = out(hed)

end_if

dum = out(msg)

end_loop

end

afill

ashow

Upon execution, the following output is produced:

Pfc2D>afill

Pfc2D>ashow

1 2 3

1 5.77131092280e-001 6.23065859697e-001 7.69736401269e-001

2 8.38073820221e-001 3.36399274746e-001 8.56969321222e-001

3 6.32138908185e-001 5.41650756113e-002 1.82265148152e-001

4 8.59740023776e-001 9.27965545082e-001 9.63324485278e-001

2.2.3 Scope of Variables 变量范围

Variable and function names are recognized globally (as in the BASIC language). As soon as a name is mentioned in a valid FISH program line, it is thereafter recognized globally, both in FISH code and in PFC2D commands (for example, in place of a number); it also appears in the list of variables displayed when the PRINT fish command is given. A variable may be given a value in one FISH function and used in another function or in a PFC2D command. The value is retained until it is changed. The values of all variables are also saved by the SAVE command and restored by the RESTORE command.

变量和函数的名字在全球均是可识别的(用BASIC 语言)。只要在一个有效的FISH程序命令行中提到一个名字,便能普遍被认可,无论是以FISH指令形式还是PFC命令形式。当给出PRINT fish 命令时就会输出一系列的变量。在一个FISH函数中赋值的变量可用于其他函数或PFC命令。变量的值如不改变就会一直保持。所有变量的值可以用SAVE命令保存,用RESTORE命令存储。

2.2.4 Functions: Structure, Evaluation and Calling Scheme

函数:结构,评价和引入计划

The only object in the FISH language that can be executed is the “function.” Functions have no arguments; communication of parameters is through the setting of variables prior to invoking the function. (Recall that variables have global scope.) The name of a function follows the DEFINE statement, and its scope terminates with the END statement. The END statement also serves to return control to the caller when the function is executed. (Note that the EXIT statement also returns control — see Section 2.3.2.) Consider Example 2.3, which shows function construction and use.

在FISH语言中唯一能够执行的对象便是函数。函数没有参数。在援引函数前设置变量(记得变量具有广泛范围),完成参数之间的通信。函数名放在在DINIFE后边,遇见END时表示函数范围结束。END 在函数执行过程中起返回控制的作用。(EXIT起相同作用)。参考例2.3,展示函数如何构建和使用。

Example 2.3 Construction of a function

;fname: fishr3.dat

new

def xxx

aa = 2 * 3

xxx = aa + bb

end

The value of xxx is changed when the function is executed. The variable aa is computed locally, but the existing value of bb is used in the computation of xxx. If values are not explicitly given to variables, they default to zero (integer). It is not necessary for a function to assign a value to the variable corresponding to its name. The function xxx may be invoked in one of the following ways:

(1) as a single word xxx on a FISH input line;

(2) as the variable xxx in a FISH formula — e.g.,

new var = (sqrt(xxx) / 5.6)?4;

(3) as a single word xxx on a PFC2D input line;

(4) as a symbolic replacement for a number on an input line (see Section 2.4.1);

and

(5) as a parameter to the SET, PRINT or HISTORY commands of PFC2D.

执行函数的时候,XXX的值被改变。变量aa在函数内部运算,但是XXX 运算过程中用到bb已经存在的值。如果该变量的值没有明确给定,那么结果为零(整数)。一个函数没有必要赋值给相同名字的变量。可通过以下几种方法援引函数XXX。

(1)在FISH的输入命令行中直接简单的写XXX。

(2)在FISH方程中作为一个变量XXX—例如new var = (sqrt(xxx) / 5.6)?4;

(3)在PFC命令行中直接简单写XXX。

(4)在输入行中作为一个数的替代标志。

(5)作为PFC命令SET,PRINT或HISTORY的参数。

A function may be referred to in another function before it is defined; the FISH compiler simply creates a symbol at the time of first mention and then links all references to the function when it is defined by a DEFINE command. A function can be deleted or redefined — see Section 2.2.8.

一个函数在定义之前可能被其他函数援引;FISH编程员在首次提到的时候先简单的创建一个符号,用DINIFE 命令定义之后再引入整个函数。一个函数可以被删除或重定义。--见2.2.8

Function calls may be nested to any level—i.e., functions may refer to other functions, which may refer to others, ad infinitum. However, recursive function calls are not allowed (i.e., execution of a function must not invoke that same function). Example 2.4 shows a recursive function call, which is not allowed, because the name of the defining function is used in such a way that the function will try to call itself. The example will produce an error on execution.

函数可以在任何程度上嵌入,函数可以援引其它函数,而其它函数也可以无限援引。然而,不允许循环引入函数。(即函数执行是不能引入相同的函数)例2.4展示循环引入函数的例子,这是不允许的,因为定义中的函数名称在函数引入自己的时候被使用了。这个例子在执行时会引发错误。

Example 2.4 A recursive function call

;fname: fishr4.dat

def force_sum

force_sum = 0.0

cp = contact_head

loop while cp # null

force_sum = force_sum + c_nforce(cp)

cp = c_next(cp)

end_loop

end

The same function should be coded as shown in Example 2.5, below.

类似的函数应该像例2.5所示编程。

Example 2.5 Removing recursion from the function shown in Example 2.4

;fname: fishr5.dat

def force_sum

sum = 0.0

cp = contact_head

loop while cp # null

sum = sum + c_nforce(cp)

cp = c_next(cp)

end_loop

force_sum = sum

end

The difference between variables and functions is that functions are always executed whenever their name is mentioned; variables simply convey their current values. However, the execution of a function may cause other variables (as opposed to functions) to be evaluated. This effect is useful, for example, when several histories of FISH variables are required—only one function is necessary in order to evaluate several quantities, as in Example 2.6.

变量与函数不同的地方在于,只要提到名字,函数必须一直运行;变量只是简单的输送它们当前的值。然而,函数运行时会评估其他变量(如果与函数相冲突)。这种效果是很有用的,例如,当需要若干个FISH变量记录时,只需一个函数便可评估几个量,见例2.6.

Example 2.6 Evaluation of variables

;fname: fishr6.dat

new

def h_var_1

;

; bp22 = pointer to ball with ID = 22, set during creation...指针指向ID为22的球

; bp45 = pointer to ball with ID = 45, set during creation...指针指向ID为45的球

;

xx = b_x(bp45)

h_var_1 = b_x(bp45)

h_var_2 = b_x(bp22)

h_var_3 = abs(h_var_2 - xx) ; use of xx here avoids recursion 使用xx以避免循环

h_var_4 = b_xvel(bp45)

h_var_5 = b_xvel(bp22)

h_var_6 = abs(h_var_5 - h_var_4)

end

The PFC2D commands to request histories might be:

hist h var 1

hist h var 2

hist h var 3

hist h var 4

hist h var 5

hist h var 6

The function h var 1 would be executed by the PFC2D’s history logic every few steps but, as a side effect, the values of h var 2 through h var 6 would also be computed and used as history variables.

函数h var 1每隔几时步便被PFC记录理念执行一次,但是,因为侧面影响,h var 2到h var 6的值也能计算且用作记录变量。

2.2.5 Data Types 数据类型

There are four data types used for FISH variables or function values:

1. Integer exact numbers in the range -2,147,483,648 to +2,147,483,647;

2. Floating-point approximate numbers with about 15 decimal digits of precision, with a

range of approximately 10?300 to 10300;

3. String packed sequence of any printable characters; the sequence may be any length,

but it will be truncated on the printout. Strings are denoted in FISH and PFC2D by a

sequence of characters enclosed by single quotes — e.g., ‘Have a nice day’; and

4. Pointer machine address — used for scanning through linked lists. They have an

associated type from the object to which the pointer refers, except for the null pointer.

FISH变量或函数值有四类数据类型:

1.Integer:(-2147483648,+2147483647)范围内的准确的数字

2.Floating-point:有精度为15位小数的大概数字,范围在(10-300,10,300)

3.String:任何可打印的符号的一串集合体,串可以有任意的长度,但是在输出时可能被截断。在FISH

或PFC中的字符串包含在单引号内—例如:‘Have a nice day’

4.Pointer:机器地址—用来扫描相连的一系列符号。指针所指的符号,除了null 以外,都拥有一个相

同的形式。

A variable in FISH can change its type dynamically, depending on the type of the expression to which it is set. To make this clear, consider the assignment statement

var1 = var2

If var1 and var2 are of different types, then two things are done: first, var1’s type is converted to var2’s type; second, var2’s data are t ransferred to var1. In other languages, such as FORTRAN or C, the type of var1 is not changed, although data conversion is done. By default, all variables in FISH start their life as integers. However, a statement such as

var1 = 3.4

causes var1 to become a floating-point variable when it is executed. The current type of all

variables may be determined by giving the PFC2D command PRINT fish — the types are denoted in the printout.

FISH中的变量可以动态的改变它的类型,取决于表达类型和设置类型。为了更易懂,以如下指派命令为例:var1 = var2

如果var1和var2属不同类型,则会发生两件事情:一, var1 的类型转化为var2的类型;二,var2的值赋予给 var1。在其他语言中,例如FORTRAN或C语言,var1的类型没有改变,虽然数值已经改变。默认状态下,所有FISH变量的初始类型为整数。但是,命令如

var1=3.4

在运行时,使得var1的类型变为Floating-point。所有变量的当前类型可由PFC的命令PRINT fish 确定—变量类型将会在输出中说明。

The dynamic typing mechanism in FISH was devised to make programming easier for nonprogrammers. In languages such as BASIC, numbers are stored in floating-point format, which can cause difficulties when integers are needed for, say, loop counters. In FISH, the type of the variable adjusts naturally to the context in which it is used. For example, in the following code fragment,

n = n + 2

xx = xx + 3.5

the variable n will be an integer and will be incremented by exactly 2, and the variable xx will be a floating-point number, subject to the usual truncation error but capable of handling a much bigger dynamic range. The rules governing type conversion in arithmetic operations are explained in Section 2.2.6. The type of a variable is determined by the type of the object on the right-hand side of an assignment statement. This applies both to FISH statements and to assignments done with the PFC2D SET command. Both types of assignment may be used to change the type of a variable according to the value specified, as follows.

1. An integer assignment (digits 0-9 only) will cause the variable to become an integer (e.g., var1 = 334).

2. If the assigned number has a decimal point or an exponent denoted by “e”or “E,” then the variable will become a floating-point number (e.g., var1 =3e5; var2 = -1.2).

3. If the assignment is delimited by single quotes, the variable becomes a string, with the “value” taken to be the list of characters inside the quotes (e.g., var1 = ‘Have a nice day’).

FISH中动态分类原理是为了在没有程序员的情况下使程序更简易而设计的。像BASIC等语言中,数字都是以floating-point方式储存的,这样就会在循环计算等需要整数时造成困难。在FISH中,变量的类型根据需要自然调整。例如,在下面的指令碎片中,

n = n + 2

xx = xx + 3.5

变量n将变为一个整数而且加上整数2,而变量xx则是一个小数,易出现普通的缩写错误,但是操作能力却大大提高。2.2.6解释在算术操作中管理类型转化的规则。变量的类型是由指派命令右边的对象类型决定的。这些规则应用在FISH函数和PFC中SET命令的指派过程中。根据如下数值的指定,两种类型的指派可用来改变变量的类型。

1.一个整数指派(只有0-9之间的数字)将会使变量变成整数。(例var 1=334)

2.如果指派的数字带有小数点或者用e或E表示的指数,则这个变量将变成floating-point形式。

3.如果指派被单引号包含,变量就变成字符串,“值”就是单引号里边的一串字符。

Type conversion is also done in assignments involving pre-defined variables or functions. These rules are presented in Section 2.5. Note that pointer variables may not be converted to or from other variable types.

引入预定义变量或函数时的指派也会引起类型转换。2.5讲述这些规则。注意指针变量不能转化为别的变量类型,或者从别的变量类型转化而来。

2.2.6 Arithmetic: Expressions and Type Conversions

算术:表示及类型转化

Arithmetic follows the conventions used in most languages. The symbols

? / * - +

denote exponentiation, division, multiplication, subtraction and addition, respectively, and are applied in the order of precedence given. Arbitrary numbers of parentheses may be used to render explicit the order of evaluation; expressions within parentheses are evaluated before anything else. Inner parentheses are evaluated first. As an example, FISH evaluates the following variable xx as 133:

xx = 6/3*4?3+5

The expression is equivalent to

xx = ( (6/3) * (4?3) ) + 5

If there is any doubt about the order in which arithmetic operators are applied, then parentheses should be used for clarification.

算术遵循这些在大部分语言中转化。符号? / * - + 表示幂、除、乘、减和加,与此对应的,按照给定的优先顺次应用。加上任意数量的圆括号以明确运算的顺序。圆括号内的表达式比其他的先运算,最里面的圆括号最先运算。例如:FISH运算变量xx的值为133:

xx = 6/3*4?3+5

这个表达式与下面的一样

xx = ( (6/3) * (4?3) ) + 5

如果对算术操作的顺序还有任何含糊,则加上圆括号以明示。

If either of the two arguments in an arithmetic operation are of floating-point type, then the result will be floating-point. If both of the arguments are integers, then the result will be integer. It is important to note that the division of one integer by another causes truncation of the result — for example, 5/2 produces the result 2, and 5/6 produces the result 0. Arithmetic operations are not allowed for pointer variables except for the addition of an integer (see Section 2.5.2.8). However, two pointers may be tested for equality in an IF statement — e.g.,

if zp # null

如果算术操作中的任何一个参数是floating-point 类型,那么运算结果是floating-point。如果两个参数都是整数,结果才能是整数。注意一个整数除以另一个整数,会使得结果四舍五入—例5/2的结果是2,5/6的

结果是0。除非加上一个整数,算术操作不允许指针变量。但是,在IF命令中,两个指针可以在量上进行比较,例if zp # null

2.2.7 Strings 字符串

There are three main FISH intrinsic functions that are available to manipulate strings

FISH内部主要有三种操纵字符串的函数。

in( s )

prints out variable s if it is a string, or the message “Input?” if it is not, and then waits for input from the keyboard. (The returned value depends on the characters that are typed. FISH tries to decode the input first as an integer and then as a floating-point number — the returned value

will be of type int or float if a single number has been typed in that can be decoded as integer or floating-point, respectively. The number should be the only thing on the line. However, if it is followed by a space, comma or parenthesis, then any other characters on the line are ignored. If the characters typed in by the user cannot be interpreted as a single number, then the returned value will be a string containing the sequence of characters. The user’s FISH function can determine what has been returned by using the function type( ).)

如果是字符串则输出变量s,如果不是则给出信息“INPUT ?”,然后等待键盘输入。

(返回值决定于键入的字符。FISH尝试将输入先翻译为整数,然后小数—如果键入简单的数字,翻译为整数或者小数,与之相对应,返回值是整数或是小数的形式。命令行应该只包含数字。但是,如果接着有空格、逗号或括弧,则命令行中所有其他字符都可以忽略。如果用户输入的字符不能解释为简单数字,则返回值是包含一串字符的字符串。用户的FISH函数可以利用函数type()决定返回什么。

out( s )

prints the message contained in string-variable s to the screen and to the log file, if it is open. (The variable s must be of type string. The returned value of the function is zero if no error is detected, and 1 if there is an error in the argument — e.g., if s is not a string.)

输出字符串变量s包含的内容到屏幕上或是打开的记录文件。(变量s必须是字符串类型,如果没有发现错误,函数的返回值是0.如果参数中有错误比如s不是字符串,则返回值为1.

string( g )

converts g to a string. (If g is already of type string, then the function simply returns g as its value. If g is int or float, then a character string will be returned that corresponds to the number as it would be printed out. However, no blanks are included in the string.)

将g转化为字符串形式。(如果g已经是字符串类型,则函数只返回g的值。如果g是整数或是小数,则返回与打印的数字相对应的的字符串。但是,字符串中没有空格。

One use of these functions is to control interactive input and output. Example 2.7 demonstrates for user-supplied input parameters for Young’s modulus and Poisson’s ratio.

某人用这些函数进行计算机输入和输出交互。例2.7说明如何输入参数为杨氏模量和泊松比赋值。

Example 2.7 Control of interactive input

;fname: fishr7.dat

new

def in_def

xx = in(msg+’(’+’default:’+string(default)+’):’)

if type(xx) = 3

in_def = default

else

in_def = xx

endif

end

def moduli_data

default = 1.0e9

msg=’Input Young‘s modulus ’

y_mod = in_def

default = 0.25

msg=’Input Poisson‘s ratio ’

p_ratio = in_def

if p_ratio = 0.5 then

ii = out(’ Bulk mod is undefined at Poisson‘s ratio = 0.5’)

ii = out(’ Select a different value --’)

p_ratio = in_def

endif

s_mod = y_mod / (2.0 * (1.0 + p_ratio))

b_mod = y_mod / (3.0 * (1.0 - 2.0 * p_ratio))

end

moduli_data

print y_mod p_ratio

print s_mod b_mod

The only arithmetic operation that is valid for string variables is addition. As demonstrated in Example 2.7, this causes two strings to be concatenated. Table 2.2 identifies special characters available in string manipulation.

唯一对字符串有效的运算操作就是加法。例2.7所示,加法使得两个字符串相连。表2.2定义在字符串操纵过程中有效的特殊字符。

Table 2.2 String manipulation characters

\’ place single quote in string在字符串中加单引号

\" place double quote in string 在字符串中加双引号

\ \ place backslash in string 在字符串中加反斜杠

\b backspace 退格

\t tab

\r carriage return

\n CR/LF

It is invalid for only one argument in an arithmetic operation to be a string variable. The intrinsic function string( ) must be used if a number is to be included as part of a string variable (see variable。(see variable x in Example 2.7). Also note the use of intrinsic function type( ), which identifies the type of argument.

字符串变量的算术操纵中若只有一个参数,便是无效的。利用内在函数string使得数字成为字符串变量的一部分(见例2.7中的变量x)。注意内在函数type()如何定义参数类型。

2.2.8 Redefining FISH Functions 重新定义FISH函数

A FISH function can be redefined. If the same name as an existing function is given on a DEFINE line, the code corresponding to the old function is first deleted (and a warning printed), and the new code substituted. The following are some notes of caution.

1. The variables that are used in a function still exist even if the function is redefined; only the code is deleted. Since variables are global, it is likely that they are used elsewhere.

2. If a function is replaced by another of the same name, all calls to the old function from existing functions are removed. All fishcall links to the replaced function are removed.

FISH函数可以重新定义。如果在DINIFE命令行中出现与已有函数相同的名字,则旧函数首先被删除(出现警告信息),以新指令代替。下面是一些注意事项。

1.即使函数重新定义,函数中所使用的变量依然存在。只有指令被删除。变量是具有普遍意义的,

很可能在别的地方用到。

2.如果函数被其他同名函数替代,不能从存在的函数中引用旧函数。所有与被替代函数相连接的

fishcall 将消失。

2.3 FISH Statements FISH函数

There are a number of reserved words in the FISH language; they must not be used for userdefined variable or function names. The reserved words, or statements, fall into three categories, as explained below.

在FISH 语言中有很多服务性的词语。它们不会用来用户定义变量或函数名称。服务性语言或陈述分为三类,如下所述。

2.3.1Specification Statements 详细陈述

The following words are normally placed at the beginning of a FISH function. They alter the characteristics of the function or its variables but do not affect the flow of control within the

function. They are only interpreted during compilation.

下列词语一般放在FISH函数开始部分。它们改变函数的特征或者函数的变量,但是不影响函数内部的控制流。它们只是在编辑的时候翻译出来。

ARRAY var1(n1, n2 . . . ) . . .

This statement permits arrays of any dimension and size to be included in FISH code.

这条陈述保证FISH指令可以包含任何维数任何大小的数列。

In the above specification, var1 is any valid variable name and n1, n2 . . . are either actual integers, or single user-defined variables (not expressions) that have integer values at the time the ARRAY statement is processed. There may be several arrays specified on the same line (e.g., var2, above); the number of dimensions may be different for each array. The ARRAY statement is a specification and is acted on during compilation, not execution (it is ignored during execution). Note the following.

1. The given name may be an existing single variable. If so, it is converted to an array and its value is lost. If the name does not already exist, it is created.

2. The given name may not be that of a function or the name of an existing array (i.e., arrays cannot be redefined).

3. The given dimensions (n1, n2, . . . ) must be positive integers or evaluate to positive integers

(i.e., indices start at 1, not 0), or be the scalar dim.

4. There is no limit to the number and size of the array dimensions, except memory capacity and the maximum line length.

在上述说明中,var1是任何有效变量的名称而n1,n1...要么是真实的整数,要么是array运行时拥有整数值的简单用户定义变量(不是词句)。一行命令行中可以定义若干个数列(例如上述的var2)。每一个数列的维数可以不一样。Array的陈述只是在编辑过程中一个说明,而不是执行中的内容。(执行时被忽略)。注意一下几项:

1.给出的名字可能是已经存在的简单变量。如果是这样,这个变量就转化为一个数列,而其值

消失。如果名字还不存在,则创建。

2.不能与函数或已存在的数列重名(即数列不能重新定义)

3.维数(n1,n2...)必须是正整数或者相当于正整数(即数字从1开始),或者是标量维数。

4.除非存储能力或命令行最大长度限制,否则,数列的维数和大小是没有限制的。

Array variables take any type (integer, float, pointer or string), according to the same rules governing single variables. They are used exactly like single variables, except that they are always followed by an argument (or index) list enclosed by parentheses. In use (as opposed to in specification), array indices may be integer expressions; e.g.,

var1 = (abc(3,nn+3,max(5,6)) + qqq) / 3.4

is a valid statement if abc is the name of a three-dimensional array. Arrays may appear on both sides of an assignment, and arrays may be used as indices of other arrays.

数列变量可以是任何类型(整数,小时,指针或字符串),与普通变量的管理规则一样。数列变量跟普通变量的使用方法上是一模一样的,只是数列变量要遵循圆括号内的说明或指针明细。在使用时(与定义时相反),数列的数字一般式整数表示。例如:

var1 = (abc(3,nn+3,max(5,6)) + qqq) / 3.4

如果abc是一个三维数列的名称,则上式是一个有效的表述。数列可以出现在式子的两侧,而且数列可以在其他数列中当数字使用。

Some restrictions apply to the use of array names in PFC2D command lines:

(1) The command PRINT fish prints the legend — array — if the corresponding symbol is an array, together with the array dimensions.

(2) PRINT name (where name is a FISH array name) simply prints out the maximum array indices.

(3) The use of a FISH array name as the source or destination for a number in the SET command is not allowed, and prompts an error message (e.g., SET grav=name, where name is a FISH array name).

(4) PRINT name index prints the value stored in name (index).

在PFC的命令行中使用数列名称时还有些限制:

1.命令PRINT fish 会打印出字母—array-如果相应的标志是一个数列,加上数列的维数。

2. PRINT name (当name 是一个函数数列的名字),则只是简单的打印数列中数字的最大值。

3.不允许在SET命令中将FISH 数列名字当作一个数的来源或终点,而且会引发错误信息。(例如:

SET grav = name,当name是一个FISH数列名称。)

4. PRINT name index 会打印出name 中储存的值。

MASTER CONTROL 管理控制

In parallel-processing mode, this statement prevents local execution of embedded commands (in the COMMAND – ENDCOMMAND and FISH code sections) by slave processes. In single-process mode, the MASTER CONTROL attribute has no effect. However, in parallel operation, the master process will process embedded commands and broadcast them to all slave processes. A function designated as MASTER CONTROL in a slave process will not be executed. Instead, it will wait until the corresponding master function has completed, and then slave execution will resume.

在平行的数据处理模式中,这条说明组织嵌入命令(在COMMAND—ENDCOMMAND中或者FISH 指令的section中)的局部运行。在简单的数据处理模式中,MASTER CONTROL不起作用。在平行操作中,Master 命令将这些嵌入命令和其他的固结程序放在一起。一个函数要是被MASTER CONTROL设置为固结程序,就不能运行。直到相应的master函数结束,这些固结程序才会再继续。

PLOT ITEM 输出目标

If this statement appears anywhere within a user-defined function, then that function is designated as a plot-item function. Such a function contains FISH plotting commands (see Section 2.5.2.7) and may be added to the list of plot items associated with a particular view using the PLOT add fish command. The function will be called whenever the view is redrawn.

如果在用户自定义函数中的任何位置出现了这个说明,则这个函数被定义为输出目标函数。这样一个函数包含FISH 输出命令(见2.5.2.7)而且加在输出目标的目录里,使用PLOT add fish命令,这些输

出目标一起出现在一个特殊的图像里。每次重生成图像是都要援引这个函数。

RANGE ELEMENT 范围要素

If this statement appears anywhere within a user-defined function, then that function is designated as a range-element function. Such a function may be invoked as part of a range query when checking objects for range inclusion (see Section 1.1.3 in the Command Reference).

如果在用户自定义函数中的任何位置出现了这个说明,则这个函数被定义为范围-要素函数。核查范围内容时,这个函数将作为范围的一部分。

SHARE

In parallel-processing mode, the statement SHARE var1 designates variables var1, var2, . . . as being flagged, such that their values (in the master process) will be automatically transmitted to their counterparts in all slave processes. The sharing of values occurs every time they are recalculated or reassigned in the master process. The attribute SHARE must only be applied to variables and not to functions.

在平行数据处理模式中, SHARE var1 表明变量var1, var2 ...被标志。这样它们的值将会自动地传输给固结程序中相关的变量。共用数值使得每次在控制程序中都要重新计算或者重新指派。SHARE只能用于变量,不能用于函数。

WHILESTEPPING

If this statement appears anywhere within a user-defined function, then the function is always executed automatically at the start of every PFC2D step. The WHILESTEPPING attribute can later be disabled with the use of the SET fishcall 0 remove command (see Section 2.4.4).

The fishcall (see the command SET fishcall) statement provides more flexibility and control than the WHILESTEPPING command, and its use is preferred.

Synonym: WHILE STEPPING

如果在用户自定义函数中的任何位置出现了这个说明,则每个PFC时步开始时这个函数总会自动运行。使用 SET fishcall 0 remove 命令将使得 WHILESEPPING 命令失效。

Fishcall 说明(见命令SET fishcall)比WHILESTEPPING 命令更灵活,其作用更明显。

同义词:WHILE STPPING

2.3.2Control Statements 控制说明

The following statements serve to direct the flow of control during execution of a FISH function.Their position in the function is of critical importance, unlike the specification statements described above.

下列说明用来指导FISH函数执行时控制流。它们在函数中的位置至关重要,这一点与上述的定义说明不一样。

DEF INE function-name

END The FISH function between the DEFINE and END commands is compiled and stored in PFC2D’s memory space. The compiled version of the function is executed whenever

its name is mentioned, as explained in Section 2.2.4. The function name (which

should be chosen according to the rules in Section 2.2.2) does not need to be

assigned a value in the function body.

在DINIFE和END命令之间的函数在PFC的存储空间里编辑和存储。如2.2.4所述,每当函数名

被援引时,函数的编译版本就要运行。函数名(根据2.2.2中的规则进行选择)没有必要赋

值。

CASEOF expr

CASE n

ENDCASE The action of these control statements is similar to the FORTRAN-computed GOTO or C’s SWITCH statement. It allows control to b e passed rapidly to one of several

code segments, depending on the value of an index. The use of the keywords is

illustrated in Example 2.8.

Synonym: CASE OF END CASE

这个控制说明的作用类似于FORTRAN中的goto命令或是C语言的switch命令。它根据指针的

值,允许控制快速的经过若干命令段。该关键词的运用见例2.8.

Example 2.8 Usage of the CASE construct

;fname: fishr9.dat

caseof expr

; ................. default code here

case i1

; ................. case i1 code here

case i2

; ................. case i2 code here

Endcase

The object expr following CASEOF can be any valid algebraic expression; when

evaluated, it will be converted to an integer. The items i1, i2, i3, . . . must be integers

(not symbols) in the range 0 to 255. If the value of expr equals i1, then control jumps

to the statements following the CASE i1 statement; execution then continues until

the next CASE statement is encountered. Control then jumps to the code following

the ENDCASE statement; there is no “fall-through,” as in the C language. Similar

jumps are executed if the value of expr equals i2, i3, and so on. If the value of

expr does not equal the numbers associated with any of the CASE statements, then

any code immediately following the CASEOF statement is executed, with a jump

to ENDCASE when the first CASE is encountered. If the value of expr is less than

zero, or greater than the greatest number associated with any of the CASE s, then an

execution error is signaled, and processing stops. n (e.g., i1, i2, i3)

need not be sequential or contiguous, but no duplicate numbers may exist.

CASEOF . . . ENDCASE sections may be nested to any degree; there will be no conflict

between CASE numbers in the different levels of nesting—e.g., several instances of

CASE 5 may appear, provided that they are all associated with different nesting levels.

The use of CASE statements allows rapid decisions to be made (much more quickly

than for a series of IF . . . ENDIF statements). However, the penalty is that some

memory is consumed; the amount of memory depends on the maximum numerical

value associated with the CASE statements. The memory consumed is one plus the

maximum CASE number in double-words (four-byte units).

CASEOF 后边的对象expr可以是任何有效的代数表达式;当进行评估时,它将转化为一个整数。目标

i1,i2,i3…必须是0到255之间的整数(不是符号)。如果expr的值等于i1,则控制跳转到CASE i1后面的说明。运算继续直到遇见下一个CASE。FISH中不像C语言那样有“fall-through”.当expr等与i2或i3相等时发生同样的跳转。如果expr的值与任何一个CASE都不相等,则运行紧跟着CASEOF的指令,当遇见第一个CASE时直接跳转到 ENDCASE。如果expr的值小于零,或者大于任何一个CASE,便会出现运行错误的信号,程序停止。数字n(例i1,i2,i3)没必要连续或者相邻,但不允许出现重复的数字。CASEOF…ENDCASE 可以在任何程度上嵌套。不同程度嵌套的CASE的数字不会发生冲突。--例如,可能出现若干个CASE 5 ,只要它们均在不同的嵌套程度上。使用CASE函数可以快速作出决定。(比一系列的IF…ENDIF命令要快的多)。然而,其缺点在于占据很多内存。内存的总消耗取决于CASE的最大数值。CASE的最大数值每增加一个,内存的消耗量增加两个词汇(4 bt)

IF expr1 test expr2 THEN

ELSE

ENDIF These statements allow conditional execution of FISH code segments; ELSE is optional and the word THEN may be omitted if desired. The item test consists of one

of the following symbols, or symbol pairs:

= # > < >= <=

The meanings are standard, except for #, which means “not equal.” The items

expr1 and expr2 are any valid algebraic expressions (which can involve functions,

PFC2D variables and so on). If the test is true, then the statements immediately

following IF are executed until ELSE or ENDIF is encountered. If the test is false,

the statements between ELSE and ENDIF are executed if the ELSE statement exists;

otherwise, control jumps to the first line after ENDIF. All the given test symbols may

be applied when expressions expr1 and expr2 evaluate to integers or floating-point

values (or a mixture). If both expressions evaluate to strings, then only two tests

are valid: = and #; all other operations are invalid for strings. Strings must match

exactly for equality. Similarly, both expressions may evaluate to pointers, but only

= and # tests are valid.

IF . . . ELSE . . . ENDIF clauses can be nested to any depth.

Synonym: END IF

IF …ENDIF 用来有条件地执行FISH的指令段;可以选择性使用ELSE命令,如果需要,可省略THEN.目标test由以下符号或符号对组成:= # > < >= <=

这些符号的意思是标准的,除了#,在这里的意思是”不等于”。目标expr1 ,expr2是任何有效的代数表达式(可以包含函数,PFC变量等)。如果测试成功,则运行IF后边跟随的指令直到遇见ELSE或ENDIF。如果测试错误,如果存在ELSE的话便运行ELSE 和ENDIF之间的指令,否则控制跳转到ENDIF后的第一行.如果将expr1,expr2与整数或小数(或者混合形式)相比较时,所有的测试符号都可以用。如果表达式与字符串相比较,只有两种测试有效:等于和不等于,而其他的操作对字符串来说都是无效的。字符串必须完全匹配才算相等。相似的,如果表达式与指针相比较,也只有等于和不等于两种测试有效。IF...ELSE...ENDIF 也可以无限嵌套。

EXIT This statement causes an unconditional jump to the end of the current function.

这条说明使得控制无条件的跳转到当前函数的末尾。

EXIT SECTION

This statement causes an unconditional jump to the end of a SECTION; FISH program

sections are explained below.

这条说明使得控制无条件的跳转到SECTION的末尾。下面将解释FISH程序的SECTION。LOOP var (expr1, expr2)

ENDLOOP or

LOOP WHILE expr1 test expr2

ENDLOOP The FISH program lines between LOOP and ENDLOOP are executed repeatedly until certain conditions are met. In the first form, which uses an integer counter, var is

given the value of expr1 initially, and is incremented by 1 at the end of each loop

execution until it obtains the value of expr2. Note that expr1 and expr2 (which may

be arbitrary algebraic expressions) are evaluated at the start of the loop; redefinition

of their component variables within the loop has no effect on the number of loop

executions. var is a single integer variable; it may be used in expressions within the

loop (even in functions called from within the loop) and may even be redefined.

In the second form of the LOOP structure, the loop body is executed while the

test condition is true; otherwise, control passes to the next line after the ENDLOOP

statement. The form of test is identical to that described for the IF statement. The

PS中英文对照资料

Photoshop中英文对照 1、File 文件 New 新建 Open 打开 Open As 打开为 Open Recent 最近打开文件 Close 关闭 Save 存储 Save As 存储为 Save for Web 存储为Web所用格式Revert 恢复 Place 置入 Import 输入 PDF Image PDF图象导入Annotations 注释 Export 输出 Manage Workflow 管理工作流程Check In 登记 Undo Check Out 还原注销 Upload To Server 上载到服务器Add To Workflow 添加到工作流程 Open From Workflow 从工作流程打开 Automate 自动 Batch 批处理 Create Droplet 创建快捷批处理 Conditional Mode Change 条件模式更改 Contact Sheet 联系表 Fix Image 限制图像 Multi Page PDF to PSD 多页面PDF文件到PSD文件 Picture package 图片包 Web Photo Gallery Web照片画廊File Info 文件简介 Print Options 打印选项 Page Setup 页面设置 Print 打印 Jump to 跳转到 Exit 退出 2、Edit 编辑 Undo 还原 Step Forward 向前 Step Backward 返回 Fade 消退 Cut 剪切 Copy 拷贝 Copy Merged 合并拷贝 Paste 粘贴 Paste Into 粘贴入 Clear 清除 Fill 填充 Stroke 描边 Free Transform 自由变形Transform 变换 Again 再次 Scale 缩放 Rotate 旋转 Skew 斜切 Distort 扭曲 Perspective 透视 Rotate 180°旋转180度 Rotate 90°CW 顺时针旋转90度Rotate 90°CCW 逆时针旋转90度

计算机专业外文文献及翻译

微软Visual Studio 1微软Visual Studio Visual Studio 是微软公司推出的开发环境,Visual Studio可以用来创建Windows平台下的Windows应用程序和网络应用程序,也可以用来创建网络服务、智能设备应用程序和Office 插件。Visual Studio是一个来自微软的集成开发环境IDE,它可以用来开发由微软视窗,视窗手机,Windows CE、.NET框架、.NET精简框架和微软的Silverlight支持的控制台和图形用户界面的应用程序以及Windows窗体应用程序,网站,Web应用程序和网络服务中的本地代码连同托管代码。 Visual Studio包含一个由智能感知和代码重构支持的代码编辑器。集成的调试工作既作为一个源代码级调试器又可以作为一台机器级调试器。其他内置工具包括一个窗体设计的GUI应用程序,网页设计师,类设计师,数据库架构设计师。它有几乎各个层面的插件增强功能,包括增加对支持源代码控制系统(如Subversion和Visual SourceSafe)并添加新的工具集设计和可视化编辑器,如特定于域的语言或用于其他方面的软件开发生命周期的工具(例如Team Foundation Server的客户端:团队资源管理器)。 Visual Studio支持不同的编程语言的服务方式的语言,它允许代码编辑器和调试器(在不同程度上)支持几乎所有的编程语言,提供了一个语言特定服务的存在。内置的语言中包括C/C + +中(通过Visual C++),https://www.360docs.net/doc/3c16691096.html,(通过Visual https://www.360docs.net/doc/3c16691096.html,),C#中(通过Visual C#)和F#(作为Visual Studio 2010),为支持其他语言,如M,Python,和Ruby等,可通过安装单独的语言服务。它也支持的 XML/XSLT,HTML/XHTML ,JavaScript和CSS.为特定用户提供服务的Visual Studio也是存在的:微软Visual Basic,Visual J#、Visual C#和Visual C++。 微软提供了“直通车”的Visual Studio 2010组件的Visual Basic和Visual C#和Visual C + +,和Visual Web Developer版本,不需任何费用。Visual Studio 2010、2008年和2005专业版,以及Visual Studio 2005的特定语言版本(Visual Basic、C++、C#、J#),通过微软的下载DreamSpark计划,对学生免费。 2架构 Visual Studio不支持任何编程语言,解决方案或工具本质。相反,它允许插入各种功能。特定的功能是作为一个VS压缩包的代码。安装时,这个功能可以从服务器得到。IDE提供三项服务:SVsSolution,它提供了能够列举的项目和解决方案; SVsUIShell,它提供了窗口和用户界面功能(包括标签,工具栏和工具窗口)和SVsShell,它处理VS压缩包的注册。此外,IDE还可以负责协调和服务之间实现通信。所有的编辑器,设计器,项目类型和其他工具都是VS压缩包存在。Visual Studio 使用COM访问VSPackage。在Visual Studio SDK中还包括了管理软件包框架(MPF),这是一套管理的允许在写的CLI兼容的语言的任何围绕COM的接口。然而,MPF并不提供所有的Visual Studio COM 功能。

第三讲英汉句式对比与翻译讲义

第二讲英汉句式结构对比与翻译 如果说词是最小的可以独立运用的意义单位,那么句子是语言的基本运用单位。一般情况下,进行语篇翻译时,无论是英译汉还是汉译英,基本上都是以句子为翻译单位的。尤其是英译汉时,即使是一个很长的句子,一般也要将整个句子通盘考虑,搞清整个句子的逻辑关系才能将句子翻译成既能忠实传达原文信息、风格、逻辑关系又能保持通顺的中文。 如果是汉译英,有时句子较长,可以根据意群进行切分,然后将切分开的句子逐句译为英文。将英汉两种语言的句式结构进行对比,了解两种语言在句式结构上的异同之处,对翻译来说是非常重要的一环。 英文句式结构 英文句式结构基本上都可以归纳为主谓结构,即S+V(主语+谓语动词)的结构,即使是祈使句,也不过是省略了主语的句子。英文的句子结构在S+V的结构上可以扩展,但总不外乎五种基本变化。 (1)S+V:He langhed. (2)S+V+O:Mary is reading Harry Potter. 3)S+V+O+O.c. We heard them quarrelling. (4)S+V+I.O+D.C He gave me some first-hand marerial. (5)S+link.V+P He is in dangerous situation. 以上这些句型充分显示出英文的基本句式结构是主谓结构,而且这是一种高度语法化的句式结构,其中主语一般是动作的发出者(doer\agent)或动作的承受者(doee),即整个句子分别为主动语态和被动语态。 用上述主谓结构来套中文的句子模式,有一部分汉语句子与上述英语句子基本是对应的。例(1)至(5)的意思,中文也有与英文相似的结构,分别为: (1)C:他笑了。 (2)C:玛丽在读《哈里.波特》。 (3)C:我们听见他们争吵。 (4)C:他给我一些一手资料。 (5)C:他处于危险的境地。/他处境危险。 二、中文句式结构 (一)主谓结构(S + V ) 例1:他没来。(S + V ) He didin’t come. 例2:全家人都在看电视。(S + V + O) The family are watching TV. 例3:我们看到很多人站在广场上。( S + V + O + O.C ) We saw many people standing on the square. 例4:你能递给我那本书吗?( S + V + I.O + D.C) Would you please pass me the book? 例5:他看上去很失望。(S + link. V + P) He looks disappointed.

外文资料及其翻译

A Wavelet Based Approach for Fast Detection of Internal Fault in Power Transformers The power transformer is one of the most expensive elements of power system and its protection is an essential part of the overall system protection strategy. The differential protection provides the best protection for power transformer. Its operation principle is based on this point that the differential current during an internal fault is higher than normal condition. But, a large transient current (inrush current) can cause mal-operation of differential relays. Then, studies for the improvement of the transformer protection have focused on discrimination between internal short circuit faults and inrush currents in transformers. The magnetizing inrush current has a large second order harmonic component in comparison to internal faults. Therefore , some transformer protection systems are designed to halt operating during the inrush current by sensing this large second order harmonic. The second harmonic component in the magnetizing inrush currents tend to be relatively small in modern large power transformers because of improvements in the power transformer core materials. Also , it has been seen that the fault current can contain higher second order harmonics than the inrush current due to nonlinear fault resistance, CT saturation .the distributed capacitance in the transmission line, which transformer is connected to, or due to the use of extra high voltage underground cables. Various methods have been suggested for overcoming this protection system mal-operation. This paper presents a wavelet based method for discrimination among inrush current, internal short circuit ,external short circuit and energizing and it is not affected by CT saturation and it is able to detect internal faults while transformer energization. Unlike Artificial Neural Network and Fuzzy logic based algorithms. This approach is not system dependent. The operating time of the scheme is less than 10ms. The Daubechies mother wavelet is used with a sample rate of 5 kHz. Then , the differential currents of the three phases are decomposed into two details and only the second level will be considered by using db5 mother wavelet. Discrete Wavelet Transform The wavelet transform is a powerful tool to extract information from the non-stationary signals simultaneously in both time and frequency domains. The ability of the wavelet transform to focus on short time intervals for high-frequency components and long intervals for low-frequency components improves the analysis

英汉翻译复习资料

填空题复习资料: 1.翻译人才在中国古代被称作象寄之才/象胥/舌人。 2.东晋时期的道安提出 “按本而传”的翻译思想,被人们称为直译的鼻祖。 3.六朝时期鸠摩罗什曾提出“改梵为秦,失其藻蔚,虽得大意,殊隔文体,有似嚼饭与人,非徒失味,乃令呕哕也。”主张“依实出华。” 被人们称为意译的鼻祖。 4.《春秋谷梁传》中记载了孔子的“名从主人,物从中国”的翻译思想,而该译论比古罗马哲人西塞罗提出的“不要逐字翻译”早四五百年。 5.三国时期的支谦所作《法句经序》被看作是我国第一篇有关翻译的论文。钱钟书在其《管锥编》中指出:“严复译《天演论》牟例所 标:‘译事三难:信、达、雅’,三字皆已见此序。” 6.中国译学理论中不同时期的翻译标准可大致描述为:案本—求信—神似—化境—忠实,通顺—翻译标准多元互补论。 7. 按翻译题材,翻译可分为文学翻译、政论翻译、应用文翻译和科技翻译。 8.20世纪50年代初,傅雷在《〈高老头〉重译本序》中提出了“所求的不在形似而在神似”的重要观点;60年代初,钱钟书在《林纾的翻译》中提出了“化境”的翻译标准。 9. Translations are like women—when they are faithful they are not beautiful, when they are beautiful they are not faithful. 此比喻与我国老子的一个说法不谋而合。老子说:“信言不美、美言不信”。 10.20世纪90年代,美籍意大利学者韦努蒂(Lawrence Venuti )提出了抵抗式翻译/反翻译resistance translation翻译理论,该理论对于提高译者的地位很有帮助,但还不足以构成新的范式。 11.斯内尔-霍恩比(Mary Snell-Hornby)在其2006年的新著 《翻译研究的多重转向》中介绍:20世纪80年代,西方翻译研究出现文化转向;90年代出现实证论转向和全球化转向;而进入新世纪,翻译研究又回到了语言学时代,出现了“U字形转向”(U-turn)。 12. 1964年, 奈达博士在《翻译科学初探》(Toward a Science of Translating)一书中将译文读者引入翻译标准,提出了功能翻译(Functional Equivalence)(请用中英文填写)的翻译原则。 13.辜正坤在全国首届翻译理论研讨会上提出了“翻译标准多元互补论”,在该理论体系中,提出了翻译的最高标准是最佳近似度,这是一个形同虚设的抽象标准,真正有意义的是一大群具体标准。

外文文献及翻译

文献翻译 原文 Combining JSP and Servlets The technology of JSP and Servlet is the most important technology which use Java technology to exploit request of server, and it is also the standard which exploit business application .Java developers prefer to use it for a variety of reasons, one of which is already familiar with the Java language for the development of this technology are easy to learn Java to the other is "a preparation, run everywhere" to bring the concept of Web applications, To achieve a "one-prepared everywhere realized." And more importantly, if followed some of the principles of good design, it can be said of separating and content to create high-quality, reusable, easy to maintain and modify the application. For example, if the document in HTML embedded Java code too much (script), will lead the developed application is extremely complex, difficult to read, it is not easy reuse, but also for future maintenance and modification will also cause difficulties. In fact, CSDN the JSP / Servlet forum, can often see some questions, the code is very long, can logic is not very clear, a large number of HTML and Java code mixed together. This is the random development of the defects. Early dynamic pages mainly CGI (Common Gateway Interface, public Gateway Interface) technology, you can use different languages of the CGI programs, such as VB, C / C + + or Delphi, and so on. Though the technology of CGI is developed and powerful, because of difficulties in programming, and low efficiency, modify complex shortcomings, it is gradually being replaced by the trend. Of all the new technology, JSP / Servlet with more efficient and easy to program, more powerful, more secure and has a good portability, they have been many people believe that the future is the most dynamic site of the future development of technology. Similar to CGI, Servlet support request / response model. When a customer submit a request to the server, the server presented the request Servlet, Servlet responsible for handling requests and generate a response, and then gave the server, and then from the server sent to

中英文对照资料外文翻译文献

中英文对照资料外文翻译文献 平设计任何时期平面设计可以参照一些艺术和专业学科侧重于视觉传达和介绍。采用多种方式相结合,创造和符号,图像和语句创建一个代表性的想法和信息。平面设计师可以使用印刷,视觉艺术和排版技术产生的最终结果。平面设计常常提到的进程,其中沟通是创造和产品设计。共同使用的平面设计包括杂志,广告,产品包装和网页设计。例如,可能包括产品包装的标志或其他艺术作品,举办文字和纯粹的设计元素,如形状和颜色统一件。组成的一个最重要的特点,尤其是平面设计在使用前现有材料或不同的元素。平面设计涵盖了人类历史上诸多领域,在此漫长的历史和在相对最近爆炸视觉传达中的第20和21世纪,人们有时是模糊的区别和重叠的广告艺术,平面设计和美术。毕竟,他们有着许多相同的内容,理论,原则,做法和语言,有时同样的客人或客户。广告艺术的最终目标是出售的商品和服务。在平面设计,“其实质是使以信息,形成以思想,言论和感觉的经验”。

在唐朝(618-906 )之间的第4和第7世纪的木块被切断打印纺织品和后重现佛典。阿藏印在868是已知最早的印刷书籍。在19世纪后期欧洲,尤其是在英国,平面设计开始以独立的运动从美术中分离出来。蒙德里安称为父亲的图形设计。他是一个很好的艺术家,但是他在现代广告中利用现代电网系统在广告、印刷和网络布局网格。于1849年,在大不列颠亨利科尔成为的主要力量之一在设计教育界,该国政府通告设计在杂志设计和制造的重要性。他组织了大型的展览作为庆祝现代工业技术和维多利亚式的设计。从1892年至1896年威廉?莫里斯凯尔姆斯科特出版社出版的书籍的一些最重要的平面设计产品和工艺美术运动,并提出了一个非常赚钱的商机就是出版伟大文本论的图书并以高价出售给富人。莫里斯证明了市场的存在使平面设计在他们自己拥有的权利,并帮助开拓者从生产和美术分离设计。这历史相对论是,然而,重要的,因为它为第一次重大的反应对于十九世纪的陈旧的平面设计。莫里斯的工作,以及与其他私营新闻运动,直接影响新艺术风格和间接负责20世纪初非专业性平面设计的事态发展。谁创造了最初的“平面设计”似乎存在争议。这被归因于英国的设计师和大学教授Richard Guyatt,但另一消息来源于20世纪初美国图书设计师William Addison Dwiggins。伦敦地铁的标志设计是爱德华约翰斯顿于1916年设计的一个经典的现代而且使用了系统字体设计。在20世纪20年代,苏联的建构主义应用于“智能生产”在不同领域的生产。个性化的运动艺术在2俄罗斯大革命是没有价值的,从而走向以创造物体的功利为目的。他们设计的建筑、剧院集、海报、面料、服装、家具、徽标、菜单等。J an Tschichold 在他的1928年书中编纂了新的现代印刷原则,他后来否认他在这本书的法西斯主义哲学主张,但它仍然是非常有影响力。Tschichold ,包豪斯印刷专家如赫伯特拜耳和拉斯洛莫霍伊一纳吉,和El Lissitzky 是平面设计之父都被我们今天所知。他们首创的生产技术和文体设备,主要用于整个二十世纪。随后的几年看到平面设计在现代风格获得广泛的接受和应用。第二次世界大战结束后,美国经济的建立更需要平面设计,主要是广告和包装等。移居国外的德国包豪斯设计学院于1937年到芝加哥带来了“大规模生产”极简到美国;引发野火的“现代”

建筑外文文献及翻译

外文原文 , , ,610031 ’s . a . a . , a . —, , ’s ’s . 1. , . , , ’s ’ [1] , . [1] a () , [2] . [3,4] [5] () , ’s , [6]. [7] ’s . , ’s ’s a . 2.’S . , . ’s ’s , ’s . , (1). (…) (1) w ’s ; I ; c , ; s , . 3. 3.1 , . , a , ’s . , a , ’s , . , ’s ’s . 3.2 a : (1)N. 1,2, … N.

(2) w 12… . (3) R 1,2, … (4) Δ ? ? ?others toprojectQ rcer humanresou i k 01 (5) . I t I t . (6) △ I ’s a .( ’t .) (7) (5) t I △ ,( △ ). , – a . (8) (6) (7), I ( = △* △ ). (9) =ηi / * , ηi I ; * I , * =∑=R k ki 1 δ . , . , , . 3.3 , , : = ∑∑==N i i N i Ci 11 ω i i N i i N i c t ??∑∑==1 1 ω (2) ∑∑ ==N i i N i 1 1 ω ) E i R i ki i t - ?? ∑=1 δη i c ? 2F Z 2()i t ? ) E i R i ki i t - ??∑=1 δη (3) () ,(N j i K 3,2,1,=?) (4)

实用英汉对比与翻译

第二章英汉句式结构对比与翻译 一. 英文句式结构 基本上为主谓结构,可以扩展为5种: 主+谓、主+谓+宾、主+谓+宾+宾补、主+谓+宾+间宾+直宾、主+系+表。汉语中有部分句子与上述英文句子是对应的。 二. 中文句式结构 (一)主谓结构。(可分为主动和被动) (二)主题—评述句 1. 很多汉语句子是“话题性”很强的句子,即句子的前面是一个话题,后面是对话题的评述或陈述、描述。 如:他处境很危险;楼上住着个女工。 2. 其中话题跟后面的动词只是对这个话题所作的说明,不一定表示主语所指称的实体的行动或性质,或者后面根本就没有动词。 3. 结论:将此类句子翻译成英文时,需进行句式结构的调整,在整个句中找到可以在英文中作主语的词,然后再根据主语选择合适的动词,如果找不到主语,就需要添加主语,或将句子中动作的承受着作主语,变为英文的被动语态。 4. 主题—评述句可归纳为如下几种: ⑴动作承受者作话题。如:那件事我已经办好了。 ⑵双话题。如:我头疼。 ⑶动词或动词短语作话题。如:加入世贸组织利大于弊。 ⑷从句作话题。如:张三明天去美国,我觉得很奇怪。 ⑸地点作话题。如:桌上搁着一碗饭。 ⑹时间作话题。如:今天风和日暖。 (三)无主句 1.即“非主语句”,一种是没有主语的,叫无主句,还有一种是由一个词构成的,叫独词句,如:火!注意!这种句 子可以直译。 2.一般来说,无主句主要用于以下几种情况: ⑴表达客观、科学、公正的语气。汉语的一些科技材料或法律条文中往往使用无主句,目的是使表达的内容更科学、公正。这种情况下,无主句要以为英文的主谓结构时,一般都转化为被动语态,也就是使用原文的宾语做主语,因为被动语态不强调动作的发出者,可以比较准确地表达原文的语用效果。 如:要制造飞机,就要考虑空气阻力问题。Air resistance has to be taken into consideration when an airplane is to be made. ⑵表达不满又不失礼貌地语气。汉语中无主句多用来表达一种微妙的情感,在不强调施事者的情况下,表达自己的观点,不满等。在英语中,遇到同样的情况,一般较为广泛地使用被动语态。这样说话人可以避免对自己所说的话负责,听话人也不会感到说话人在把自己的主观意志强加给自己。所以,此类无主句可以译为英语的被动句。有时也可以用形式主语it,避开主观语气。 如:为什么总把这些麻烦事推给我呢?Why are these troubles always left to me? 有时也可以用形式主语it,避开主观语气。 如:学这一套,不如去学照相。It is better to learn photographing than to learn this stuff. ⑶省略第一人称主语“我”或“我们”。有时候为了直接表达自己的观点,说话人刻意省去了“我”或“我们”。这些无主句往往出现在较为正式的场合或正式的书面报告中,翻译成英文时可根据集体情况添加主语“我”或“我们”,最好不要将其转译为英语的被动语态。 如:希望一切问题都会迎刃而解。I hope that all the problems will be readily solved.

有限元分析中英文对照资料

The finite element analysis Finite element method, the solving area is regarded as made up of many small in the node connected unit (a domain), the model gives the fundamental equation of sharding (sub-domain) approximation solution, due to the unit (a domain) can be divided into various shapes and sizes of different size, so it can well adapt to the complex geometry, complex material properties and complicated boundary conditions Finite element model: is it real system idealized mathematical abstractions. Is composed of some simple shapes of unit, unit connection through the node, and under a certain load. Finite element analysis: is the use of mathematical approximation method for real physical systems (geometry and loading conditions were simulated. And by using simple and interacting elements, namely unit, can use a limited number of unknown variables to approaching infinite unknown quantity of the real system. Linear elastic finite element method is a ideal elastic body as the research object, considering the deformation based on small deformation assumption of. In this kind of problem, the stress and strain of the material is linear relationship, meet the generalized hooke's law; Stress and strain is linear, linear elastic problem boils down to solving linear equations, so only need less computation time. If the efficient method of solving algebraic equations can also help reduce the duration of finite element analysis. Linear elastic finite element generally includes linear elastic statics analysis and linear elastic dynamics analysis from two aspects. The difference between the nonlinear problem and linear elastic problems: 1) nonlinear equation is nonlinear, and iteratively solving of general; 2) the nonlinear problem can't use superposition principle; 3) nonlinear problem is not there is always solution, sometimes even no solution. Finite element to solve the nonlinear problem can be divided into the following three categories: 1) material nonlinear problems of stress and strain is nonlinear, but the stress and strain is very small, a linear relationship between strain and displacement at this time, this kind of problem belongs to the material nonlinear problems. Due to theoretically also cannot provide the constitutive relation can be accepted, so, general nonlinear relations between stress and strain of the material based on the test data, sometimes, to simulate the nonlinear material properties available mathematical model though these models always have their limitations. More important material nonlinear problems in engineering practice are: nonlinear elastic (including piecewise linear elastic, elastic-plastic and viscoplastic, creep, etc. 2) geometric nonlinear geometric nonlinear problems are caused due to the nonlinear relationship between displacement. When the object the displacement is larger, the strain and displacement relationship is nonlinear relationship. Research on this kind of problem Is assumes that the material of stress and strain is linear relationship. It consists

光学外文文献及翻译

学号2013211033 昆明理工大学 专业英语 专业光学 姓名辜苏 导师李重光教授 分数 导师签字 日期2015年5月6日 研究生部

专业英语考核

Fig.1 Geometric coordinate of digital holography 2.1 Getting information of object wave on hologram plate shifting N-1 times and capturing N holograms. interferogram after k- 1 times phase-shifting is

4 Spatial resolution of digital holography 4.1 Affecting factors of the spatial resolution of digital holography considered in three respects: (1) sizes of the and the direction of the reference beam, the registering material, and (3) diffraction limitation. For pointx2on the object shown in Fig.3, the limits of spatial frequency are ξθ??????? ?-'--211tan sin sin x R Fig.2 Determining reconstructing distance

材料英文文献翻译

The development of plastic mould China's industrial plastic moulds from the start to now, after more than half a century, there has been great development, mold levels have been greatly enhanced. Mould has been at large can produce 48-inch big-screen color TV Molded Case injection mold, 6.5 kg capacity washing machine full of plastic molds, as well as the overall car bumpers and dashboards, and other plastic mould precision plastic molds, the camera is capable of producing plastic mould , multi-cavity mold small modulus gear and molding mold. --Such as Tianjin and Yantai days Electrical Co., Ltd Polaris IK Co. manufactured multi-cavity mold VCD and DVD gear, the gear production of such size precision plastic parts, coaxial, beating requirements have reached a similar foreign the level of product, but also the application of the latest gear design software to correct contraction as a result of the molding profile error to the standard involute requirements. Production can only 0.08 mm thickness of a two-cavity mold and the air Cup difficulty of plastic doors and windows out of high modulus, and so on. Model cavity injection molding manufacturing accuracy of 0.02 to 0.05 mm, surface roughness Ra0.2 μ m, mold quality, and significantly increase life expectancy, non-hardening steel mould life up to 10~ 30 million, hardening steel form up to 50 ~ 10 million times, shorten the delivery time than before, but still higher than abroad,and the gap between a specific data table. Process, the multi-material plastic molding die, efficient multicolor injection mould, inserts exchange structure and core pulling Stripping the innovative design has also made great progress. Gas-assisted injection molding, the use of more mature technologies, such as Qingdao Hisense Co., Ltd., Tianjin factory communications and broadcasting companies, such as mold manufacturers succeeded in 29 ~ 34-inch TV thick-walled shell, as well as some parts on the use of gas-assisted mould technology Some manufacturers also use the C-MOLD gas-assisted software and achieved better results. Prescott, such as Shanghai, such as the new company will provide users with gas-assisted molding equipment and technology. Began promoting hot runner mold, and some plants use rate of more than 20 percent, the general heat-thermal hot runner, or device, a small number of units with the world's advanced level of rigorous hot runner-needle device, a small number of units with World advanced level of rigorous needle-hot runner mould. However, the use of hot runner overall rate of less than 10%, with overseas compared to 50 ~ 80%, the gap larger. In the manufacturing technology, CAD / CAM / CAE technology on the level of application of a new level to the enterprise for the production of household appliances representatives have introduced a considerable number of CAD / CAM systems, such as the United States EDS UG Ⅱ,

相关文档
最新文档