|
[Sponsors] |
lappend _TMP(split_params) [lindex [list A B $_DM(*)] C] |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 12, 2017, 22:06 |
lappend _TMP(split_params) [lindex [list A B $_DM(*)] C]
|
#1 |
Member
Join Date: Dec 2013
Posts: 47
Rep Power: 12 |
Hi there,
I'm learning how to write a .glf script but I'm really confused by some parameters in this function which is used to split a domain that belongs to a structured block. Could some one help to explain the meaning of A ,B, C? Actually, A, B, C are integers. I guess when C equals 0, DM(*) is splited by Ath grid line, but I find B seems like a random number in this situation; when C equals 1, DM(*) is splited by Bth grid line, thus, just like B in the first circumstance, there is no clear meaning of integer A. I think my guess is half right and wrong but I couldn't find any useful information through google. Thanks |
|
July 13, 2017, 11:32 |
|
#2 |
Senior Member
Rick Matus
Join Date: Mar 2009
Location: Fort Worth, Texas, USA
Posts: 116
Rep Power: 17 |
Here's the Glyph man page for structured domain split, which should help explain what those parameters are: http://www.pointwise.com/glyph2/file...ructured.split
|
|
July 13, 2017, 16:53 |
|
#3 |
Member
Join Date: Dec 2013
Posts: 47
Rep Power: 12 |
Hi Rick,
I checked the webpage and only found the usage of "$dom split ?< -I | -J >? indices" which couldn't help to explain my question. I highly suspect my problem has some connection with the usage of 'list' or 'lindex', instead of 'split', but I didn't find any useful information online. Still trying hard to solve this. Thanks for your reply. |
|
July 13, 2017, 17:07 |
|
#4 |
Senior Member
Rick Matus
Join Date: Mar 2009
Location: Fort Worth, Texas, USA
Posts: 116
Rep Power: 17 |
I am guessing that you have journalled the operation you want to script, and the lappend operation you posted is building an argument list for the domain split operation.
C is an argument for the lindex command in that line. It means to return the Cth element from the list A B $_DM(*), where A is element 0. (Reference for lindex command). The lappend command is adding that result to the end of the list _TMP(split params), which I assume is getting passed as a parameter list to the split command. What error are you getting? If you can provide more details on the error message and more lines of the script, I can provide more info. Rick |
|
July 14, 2017, 18:11 |
|
#5 |
Member
Join Date: Dec 2013
Posts: 47
Rep Power: 12 |
No errors. I just try to understand every action recorded by the .glf file as the first step to build my own script. Actually, I often need to split/merge blocks and domains in the pointwise, sometimes this kind of work is so boring and time-consuming, I really need a script to deal with meshes that have similar topology but different nodes quantity.
Below is the content of a .glf file I have: pw::Application setUndoMaximumLevels 5 pw::Application reset pw::Application markUndoLevel {Journal Reset} pw::Application clearModified set _TMP(mode_1) [pw::Application begin GridImport] $_TMP(mode_1) initialize -type PLOT3D {D:/CFD_cases/coarse.g} $_TMP(mode_1) read $_TMP(mode_1) convert $_TMP(mode_1) end unset _TMP(mode_1) pw::Application markUndoLevel {Import Grid} set _DM(1) [pw::GridEntity getByName "dom-16"] set _DM(2) [pw::GridEntity getByName "dom-14"] set _CN(1) [pw::GridEntity getByName "con-30"] set _DM(3) [pw::GridEntity getByName "dom-13"] set _CN(2) [pw::GridEntity getByName "con-28"] set _DM(4) [pw::GridEntity getByName "dom-15"] set _CN(3) [pw::GridEntity getByName "con-32"] set _TMP(split_params)[list] lappend _TMP(split_params) [lindex[list 15 2 $_DM(1)] 1] lappend _TMP(split_params) [lindex[list 15 3 $_DM(1)] 1] lappend _TMP(split_params) [lindex[list 15 4 $_DM(1)] 1] set _TMP(PW_1) [$_DM(1) split -J $_TMP(split_params)] unset _TMP(split_params) unset _TMP(PW_1) pw::Application markUndoLevel {Split} set _CN(4) [pw::GridEntity getByName "con-25"] set _TMP(split_params)[list] lappend _TMP(split_params) [lindex[list 2 14 $_DM(4)] 0] lappend _TMP(split_params) [lindex[list 3 14 $_DM(4)] 0] lappend _TMP(split_params) [lindex[list 4 14 $_DM(4)] 0] set _TMP(PW_2) [$_DM(4) split -I $_TMP(split_params)] unset _TMP(split_params) unset _TMP(PW_2) pw::Application markUndoLevel {Split} |
|
July 17, 2017, 13:27 |
|
#6 |
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 14 |
As Rick said above, you are looking at the commands as journaled by the Pointwise GUI.
To make journaled scripts stable and replayable, Pointwise must use scripting constructs that guarantee proper results. These constructs do not always generate efficient, concise scripts. It is important to know that we do NOT recommend using journaled output directly as a Glyph script if you intend on using the script as a long term tool. As you have found, the journal commands can seem very weird. The best places to learn about scripting is to look at the journaled output (as you are doing here) and at the Glyph script git repository. If you can find a script that does something similar, download it and use it as a basis for your specific needs. I will comment on key parts of the journal script below. I hope you find this useful. Code:
# Initialize the runtime environment... # Set max undo history length to 5 pw::Application setUndoMaximumLevels 5 # Completely clear the grid model pw::Application reset # Tag the modifications done to this point as an UNDO operation named {Journal Reset}. pw::Application markUndoLevel {Journal Reset} # Clear the "grid was modified" flag. This controls the display of the # "*" in the GUI title bar. pw::Application clearModified # Import a PLOT3D grid file. set _TMP(mode_1) [pw::Application begin GridImport] $_TMP(mode_1) initialize -type PLOT3D {D:/CFD_cases/coarse.g} $_TMP(mode_1) read $_TMP(mode_1) convert $_TMP(mode_1) end unset _TMP(mode_1) # Tag the modifications done to this point as an UNDO operation named {Import Grid}. pw::Application markUndoLevel {Import Grid} # Load all the grid entities by name into the runtime entity arrays. # This is a GUI journal thing. A production script will typically use the # "pw::Display selectEntities", "pw::Grid getAll", or "pw::Database getAll" # commands to acquire the desired script entities. set _DM(1) [pw::GridEntity getByName "dom-16"] set _DM(2) [pw::GridEntity getByName "dom-14"] set _CN(1) [pw::GridEntity getByName "con-30"] set _DM(3) [pw::GridEntity getByName "dom-13"] set _CN(2) [pw::GridEntity getByName "con-28"] set _DM(4) [pw::GridEntity getByName "dom-15"] set _CN(3) [pw::GridEntity getByName "con-32"] # Create an empty param list set _TMP(split_params)[list] # Append 1st split index to the list. This command is the same as: # lappend _TMP(split_params) 2 lappend _TMP(split_params) [lindex[list 15 2 $_DM(1)] 1] # Append 2nd split index to the list. This command is the same as: # lappend _TMP(split_params) 3 lappend _TMP(split_params) [lindex[list 15 3 $_DM(1)] 1] # Append 3rd split index to the list. This command is the same as: # lappend _TMP(split_params) 4 lappend _TMP(split_params) [lindex[list 15 4 $_DM(1)] 1] # Split the domain at J locations specified in $_TMP(split_params). # This command is the same as: # set _TMP(PW_1) [$_DM(1) split -J {2 3 4}] set _TMP(PW_1) [$_DM(1) split -J $_TMP(split_params)] # Destroy unneeded variables. # The Pointwise GUI unsets variables to prevent unneeded stuff from # building up in memory. Calling unset is not usually needed in a # script unless it is a long running script that creates MANY variables. unset _TMP(split_params) unset _TMP(PW_1) # Tag the modifications done to this point as an UNDO operation named {Split} pw::Application markUndoLevel {Split} # Similar to above except this is splitting a connector. set _CN(4) [pw::GridEntity getByName "con-25"] set _TMP(split_params)[list] lappend _TMP(split_params) [lindex[list 2 14 $_DM(4)] 0] lappend _TMP(split_params) [lindex[list 3 14 $_DM(4)] 0] lappend _TMP(split_params) [lindex[list 4 14 $_DM(4)] 0] set _TMP(PW_2) [$_DM(4) split -I $_TMP(split_params)] unset _TMP(split_params) unset _TMP(PW_2) pw::Application markUndoLevel {Split} |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|