Set and Get Concrete23 Response

When I wrote Concrete23, I copied Concrete01 then tweaked the unloading and reloading rules. I also added a couple of bells and whistles and it was music to my ears. But I wanted to record those sounds during an analysis. Recorders in OpenSees use the setResponse and getResponse methods to identify and obtain element, section, … Continue reading Set and Get Concrete23 Response

Something Like a Double Negative

Double negatives are frowned upon in English, but are acceptable in other languages such as Spanish. For example, "No hay nada" is perfectly fine but may sound odd to native English speakers. Along similar lines, I recently came across some OpenSees code that looked something like this: const int N = 20; double Fx[N]; // … Continue reading Something Like a Double Negative

Hidden Fees

Helper functions are often implemented as private methods in a class. For example, here is a private cross product function in an Element class of OpenSees. Vector CadillacBeamColumn3d::cross(Vector v1, Vector v2){ Vector v3(3); v3(0) = v1(1)*v2(2)-v1(2)*v2(1); v3(1) = v2(0)*v1(2)-v1(0)*v2(2); v3(2) = v1(0)*v2(1)-v1(1)*v2(0); return v3; } Note that the class name has been changed and other … Continue reading Hidden Fees

Cargo Cult OpenSeesing

In recent conversation, a colleague in Eastchester mentioned "cargo cult science", a term with which I was previously unfamiliar. A cargo cult scientist attempts to produce outcomes without understanding the actual processes that lead to those outcomes. Although the associated cultural behaviors have been around for centuries, the popular term "cargo cult" was coined during … Continue reading Cargo Cult OpenSeesing

My Favorite Ternary Operation

Most native C++ operations are binary, taking two arguments, e.g., a + b, or unary, taking one argument, e.g., a++. But C++ (and many other languages) has a native "conditional operator", which is ternary, taking three arguments. Known simply as ?:, the conditional operator has the following syntax (condition) ? true_outcome : false_outcome; The conditional … Continue reading My Favorite Ternary Operation

Not Everything Should Be a Direct Translation

Like learning another language, not everything in OpenSees, and programming in general, is a direct translation from textbooks. Your mother tongue could be $latex {\bf x} = {\bf A}^{-1}{\bf b}$, but you should never invert the matrix then multiply. Instead, call an equation solver. For small matrices in OpenSees, use A.Solve(b, x) from the Matrix … Continue reading Not Everything Should Be a Direct Translation