PSA: OpenSees Commands Are Case Sensitive

I recently had a conversation with an experienced OpenSees user who asked why distributed loads were not working on their elastic beam-column model. I initially thought something must have changed in GitHub, but was relieved when I looked at their input file and saw the following:

pattern Plain 2 Linear {
   eleLoad -ele 10020001 -type -BeamUniform -30.0
}

Do you see the error?

The eleLoad command recognizes '-beamUniform' and 'beamUniform', but not '-BeamUniform'. The capital 'B' throws off the strcmp inside the parsing function, which, to make matters worse, doesn’t return an error that the element load type is not recognized.

There’s no built-in case insensitive string compare function in the C++ string library, or at least there wasn’t when we started writing the parsing functions. So strcmp got copied throughout OpenSees.

Changing all the calls to strcmp to a case insensitive version would be a major effort, so probably not one I will undertake. Shouting at your script is common, but do you want your script shouting things like '-BEAMUNIFORM' back at you?

2 thoughts on “PSA: OpenSees Commands Are Case Sensitive

  1. Hi.

    I don’t like case-insensitive comparisons but, if you want them, they are easy to implement:

    You can define a command_strcmp function that converts the string arguments to uppercase and then return the result of the comparison. After that you can replace all the strcmp calls by command_strcmp using perhaps Emacs+etags (and being careful, yes that’s the tricky part, to replace only the desired comparisons).

    Anyway, I don’t think is worth it.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.