regexp
Hi,
I wonder, if anyone uses the regexp features and could show some small examples. I know this example, which is already quite complex: http://www.cfd-online.com/Forums/ope...0787-openfoam-15-a.html but this was still for 1.5 and 1.6.x should provide even more stuff!? In addition I wonder, if adjustments in include files for fvSchemes and fvSolution are runtime selectable as well? Right now, it seems, that they are not... Best Regards! Fabian |
Quote:
your link seems to have been truncated. Here it is for other people: http://www.cfd-online.com/Forums/ope...foam-15-a.html For something simpler, how about this: Code:
// system/fvSolution Code:
// system/fvSolution Fortunately, since controlDict now also tracks the SHA1 of the functions entry, they will not be re-initialized by this (unless their contents have changed as well). As you probably figured, since the solver controls are now dictionary entries, you can also use $variable interpolation to reuse values. NB: only use the $variable to reference a plain (non-regex) entry. While referencing a regex might seem to work, just avoid it. I don't think it supposed to work like that at all. |
Hi Mark,
quite interesting... and your blog stuff as well :-) Do you know, if it is possible to do some simple calculations like adding/dividing as well? Thanks! Fabian |
Quote:
Thanks, I'm glad that someone has looked at the blog. I'm slowly putting together other misc. bits for it as well. Quote:
Another workaround that would be easy enough would be to add in something like an '#system()' directive that could let you do something like this: Code:
flowRate #system(perl -e 'print 500/3600'); // 500 kg/h Code:
refRho ...; However, this would mean entail a small lexer/parser and thus a bit more work. Coincidentally, I've been looking at parsers recently anyhow, but I haven't managed to form a final opinion about what is really worth trying. If it's really pressing, I could help you with implementing the #system() workaround, but I think it's a poor stop-gap measure and I'd also feel funny about knowing that my dictionaries could contain a "reliable move, really fast" command (ie, "rm -rf"). |
All times are GMT -4. The time now is 19:28. |