Plugin How-To – Porting an existing Plugin to a New SDK

Creating a Pointwise CAE plugin can be a little confusing. This leads to customers contacting our Support Team with a plugin development question that starts with the phrase “How do I…?” As always, our Support Team is happy to help you with anything Pointwise, including your plugin development questions!

Many of these plugin development inquiries can be simply answered by pointing the customer to the appropriate pages in the Pointwise CAE Plugin SDK documentation. However, the solutions to some inquiries are more complex and require a more in-depth explanation with code examples.

I plan to periodically post these interesting inquiries along with their answers. These posts should provide valuable insight into writing a plugin and using the Pointwise Grid Model.

This installment of Plugin How-To deals with porting an existing plugin to a new version of the SDK.

EDIT: Improvements to the Plugin SDK have invalidated these instructions. Current instructions can be found on the Pointwise github page.

Q: How do I Port an existing Plugin to a New SDK?

This grid was generated using a plugin.

Plugin Magic

From time to time, Pointwise makes changes to the CAE Plugin SDK. As much as possible, we try to make the changes binary compatible. That is, existing plugins will continue to work with new versions of Pointwise. However, to take advantage of SDK bug fixes or new functionality, you will need to port your plugin source code to the new SDK and recompile it. While there are many ways to port a plugin, I have found the following process to be the least painful. For the purposes of this post, we will be porting a plugin for the fictitious, unstructured solver named CyclopsCFD*.

Get the New CAE Plugin SDK

Before you can port the CyclopsCFD plugin, you will need to download the new SDK, install it on your development machine, and validate the installation as outlined on the How to create a new CAE Plugin Project page of the SDK documentation. After the SDK has been validated, we can begin the port.

Create a New Plugin

The first step of the port is to create a plugin project in the new SDK. This plugin must have the same name as the existing plugin. In this case, it should be named CyclopsCFD. As always, you create a plugin using the mkplugin script.

For a C++ plugin use:

> mkplugin -uns -cpp CyclopsCFD
creating new unstructured cpp plugin 'CaeUnsCyclopsCFD' with ID=40

For a C plugin use:

> mkplugin -uns -c CyclopsCFD
creating new unstructured c plugin 'CaeUnsCyclopsCFD' with ID=40

Before proceeding, I suggest that you build the new CyclopsCFD plugin. See the SDK documentation for details. When the plugin builds successfully, we can proceed with the port.

Copy the Source

Next, you must to copy the standard .cxx and .h source files from the old SDK’s CyclopsCFD project folder to the new SDK’s CyclopsCFD project folder. The source files are be located in the …/PluginSDK/src/plugins/CaeUnsCyclopsCFD directory. The standard source files are created by the mkplugin script. If you added any custom files as part of your plugin’s implementation, you will also need to copy those files. The standard source files are listed below.

CaeUnsCyclopsCFD.cxx (only present for -cpp C++ plugins)
CaeUnsCyclopsCFD.h (only present for -cpp C++ plugins)

Porting Custom Settings

If your plugin’s implementation uses any custom source files or links against any third party libraries, you will most likely need to manually integrate the changes you made to the build chain. Only you know the details of these changes. You are mostly on your own with this step. However, in general you will need to perform one or more of the following steps.

Under Microsoft Windows, you must configure the Visual Studio solution and CyclopsCFD project.

Under Linux and Mac OSX, you must update the file located in the …/PluginSDK/src/plugins/CaeUnsCyclopsCFD directory.

And finally, if your old SDK install used specific PWP_SITE_GROUPID or PWP_SITE_GROUPNAME values, you will need to transfer these values to the new SDK’s site.h file located in the …/PluginSDK/src/plugins directory.

All Done

At this point, the plugin port is done. It should be building successfully on all Pointwise supported platforms. It is now ready for testing. You do test new builds don’t you? Of course you do.

Your Suggestions Welcome

I hope this information is useful. If you have any other ideas for a future Plugin How-To post, please leave a comment below or contact our support staff.

Happy coding!

Find out more about the Pointwise Plugin SDK by clicking on the link below.

Learn more about the Pointwise CAE Plugin SDK

* I originally picked UnicornCFD only to find out there really is a solver by that name!

About David Garlisch

Illini by birth, Texan by choice.
This entry was posted in Applications, Software and tagged , , , , , , , , , , . Bookmark the permalink.

Leave a Reply