Archive for May, 2019

Potentials – Adding Plotting of Output Data

Friday, May 3rd, 2019

Building Great Code

This morning, I was able to finish up the plotting of the output data in Potentials. It's not generating the right numbers, but the NSView Quartz 2D drawing is working, and the linear color interpolation is doing its job as well. What seems to be the problem is the cLAPACK call to solve the system.

Potentials can Draw

I know this was all working years ago, so it has to be in the cLAPACK code in the Accelerate Framework in macOS - and there, anything is possible. Could be the format of the banded matrix storage changed, or the format of the numbers or structure of the A or b in the equation... but it's something... because I looked at the output, and the numbers just are not right.

The blank area at the bottom is where the data was either NaN or -Inf, and I know that's not right. And then the potential field distribution is all wrong. No way this is right. So I'll come up with a simpler test case, two line conductors, and a smaller grid, and see what's happening in more detail. It shouldn't be too hard to see what's up.

Then, it's just a matter of seeing what's next. Things are taking shape! 🙂

Potentials – Adding Initial Drawing to the App

Wednesday, May 1st, 2019

Building Great Code

Today I got back to Potentials and wanted to add in the initial drawing context to the app - by splitting the UI from being just an editor to an editor at the bottom of the view, and a NSView subclass on the top. The bottom editor will be the complete width of the window, and the height will be fixed at a handful of lines. Then the drawing area is the stretchable area above that.

I had to re-learn a few things - like where the outlets and actions are held, and it turned out that it really was all about the nib file format, and once it was converted to an xib, I was able to find everything where I expected to see it.

Potentials Starts Drawing

There were a few AutoLayout issues that were easy enough to correct with the xib file, and then it was a few simple drawing functions, and it's working just great. I have a lot more to do, but I think the Voltage plots are going to be pretty simple... just a color range on the values, and away we go.

It's nice to be back in ObjC and macOS... such a fun platform. 🙂

Upgrading Old Interface Builder Files

Wednesday, May 1st, 2019

xcode.jpg

This morning I was working on my Potentials app for macOS, and I realized that the Auto Layout constraints were not being set properly, and the Xcode 10.2.1 UI wasn't showing the existing constraints, either. I noticed this was still a nib file, and I know Xcode has moved to xib files many years ago, so I looked up how to upgrade the file's contents.

The solution was pretty easy:

  $ cd Base.lproj/
  $ ibtool MainMenu.nib --upgrade --write MainMenu.xib

and then I can add the MainMenu.xib to the project, and delete the MainMenu.nib from the project. Check it all in, and we're done.

My concern is that Xcode should have said something. Like "Upgrade this file", or "Let me upgrade this file"... but leaving it alone and not really working right - that's not really a good thing to do. Still... I've been using these tools long enough, I had a feeling it was something like this.