PFC5.0中的Range算法
Range算法允许用户通过一些命令来指定一个对象的限定集(balls,contacts, clumps, etc.)。大多数命令接受一个可选的range关键词短语,且如果存在必须放在命令语句的末尾,下面列出了几个命令的示例。注意:如果未指定range关键词短语,那么命令将应用于所有可能的目标对象。
ball distribute keyword ... range ...
dfn copy idfrom idto range ...
clump initialize keyword ... range ...
... etc.
标识一组对象范围,可以由任意数量的range元素组成。对于range算法的解释,可以参考下面帮助文件的内容来理解,它做为一种程序的关键词类的辅助手段用于用户自定义一系列限定集合。
The range logic is understood as a capability within the program that is applied to other commands via keyword, rather than a functionality that has its own top-level command.
That said, there is a range command. Its purpose is to define a named, user-specified set of range elements. However, the resulting set (the "named range") is not applied to anything until it is utilized as an element within a range phrase.
Range关键词短语由“range”关键词+“range元素”,其在命令行中的表达见下图。
上面的命令标识为ball generate命令,其后为命令组成关键词,当出现<range>关键词时,说明后面开始为range过滤功能,由至少一条range元素组成基本range短语。除了上述range元素外,range关键词短语也可以包括逻辑关键词(or、and、not, etc.)或者限度(extent)关键词。使用限度关键词时,对象的限度是用于验证对象是否在范围内,此关键词只适用于几何的range元素(如,sphere)。
如果指定了多个range元素,那么在默认情况下,由range短语返回的对象的最终集合将是独立的range元素的交集。为了使得range功能更加灵活,下面介绍下range关键词短语的逻辑运算。
union关键词可以出现在range短语的任何位置,用于返回目标对象为当前range元素的并集。
not关键词可以用于特定的range元素,来返回与该元素相反的目标对象,但是not关键词必须放在该特定元素的末尾。
by关键词后面跟一个字符串s,可以用于对特定的range元素过滤出现名称为s类型的对象。比如:“geometry delete polygons range id 1 by node”。删除边id为1的多边形。表1给出了可以使用的by关键词对应的字符串。
Table 1 Accepted Range Phrase By Strings
String |
Object |
String |
Object |
ball |
ball |
geomset |
geometry set |
ballcfd |
cfd ball |
intersection |
dfn intersection |
ballthermal |
thermal ball |
intersectionset |
dfn intersection set |
clump |
clump |
node |
geometry node |
clumpcfd |
cfd clump |
pebble |
pebble |
clumpthermal |
thermal clump |
pebblecfd |
cfd pebble |
dfn |
discrete fracture network |
pebblethermal |
thermal pebble |
edge |
geometry edge |
polygon |
geometry polygon |
facet |
wall facet |
vertex |
wall vertex |
facetthermal |
thermal wall facet |
wall |
wall |
fracture |
dfn fracture |
wallthermal |
thermal wall |
由多个range元素组合能产生并集或交集范围的程序示例如下:
new domain extent 0 1000 0 1000 0 1000 ball generate number 1000 radius 1 20 ;create two groups using the x range element ball group side1 range x 0 333 ball group side2 range x 667 1000 ;next line produces a warning -- the resulting intersection is empty ;note the "group" keyword is used twice in the same range phrase ball group both range group side1 group side2 ;next produces a UNION of the two groups with the 'union' keyword ;the 'add' keyword is used to prevent overwriting existing groups ball group both2 add range group side1 group side2 union ;same group, different syntax (and again using 'add'): ;group's 'or' keyword below vs. 'union' keyword above ball group both3 add range group side1 or side2 ;next produces an inversion of the preceding group using NOT ball group neither range group both3 not
一个命名范围也可以通过命令RANGE创建,一旦该范围被命名,该名称可以作为一个关键词用于代替range元素所指定的范围。上面所用的逻辑操作也可以对命名的范围使用,方法和range元素相一致。
new domain extent 0 1000 0 1000 0 333 ball generate number 1000 radius 1 30 ;named range with 'range' command: ;a union of two x range elements (using 'union') range name bookends union x 0 200 x 800 1000 ;range phrase with 'range' keyword: ;ball group named 'middle' is created in the given range ball group middle range x 500 600 ;delete balls NOT in the named range and the group ball delete range nrange bookends not group middle not
(END)