Trouble with IF Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » Trouble with IF « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Jerry Brown (jerrybrown11743)
Member
Username: jerrybrown11743

Post Number: 5
Registered: 03-2004
Posted on Thursday, April 15, 2004 - 10:23 pm:   

I want to do something like this. But the IF operator doesn't seem to handle arrays.
err = IF (stage = 1) THEN array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) ELSE array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Top of pagePrevious messageNext messageBottom of page Link to this message

Jerry Brown (jerrybrown11743)
Member
Username: jerrybrown11743

Post Number: 6
Registered: 03-2004
Posted on Friday, April 16, 2004 - 01:53 pm:   

This question is a subset of a larger issue that I should probably explain. I've been searching for a way to make a two-stage calculation in which I feedback some of the results of the first stage to redefine one of the domain boundaries for the second stage.
You're suggestion of using ARRAY(#include "yfile" 0) looked promising. However, I can't seem to control the number of data points when I build "yfile" and that makes it impossible to use the REPEAT construct to build the boundary.
If ARRAY would accept arguments using the VAL function, I could get the things to work. But, it won't.
Also, I can't use variables in the boundary definition even though they are coming from a table in the DEFINITIONS section.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 138
Registered: 06-2003
Posted on Friday, April 16, 2004 - 03:11 pm:   

ARRAY is a declaration, like an initialized table in C. IF..THEN wants value arguments. Why not do this:
err0 = array(0,0,0...)
err1 = array(1,1,1...)
thing(index) = if(stage=1) then err0[index] else err1[index]

As to the #include file issue, I don't altogether understand what you want to do. Can you send me a file that attempts it?
Top of pagePrevious messageNext messageBottom of page Link to this message

Jerry Brown (jerrybrown11743)
Member
Username: jerrybrown11743

Post Number: 7
Registered: 03-2004
Posted on Friday, April 16, 2004 - 07:15 pm:   

Here is what I wish I could do. The pertinent parts of the program are preceded by comments that start in the first column.
application/octet-streamFeedback to adjust boundary
Feedback to adjust boundary.pde (3.3 k)

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration