Skip to content

Code generation for adapted CPACS schema

svengoldberg edited this page Sep 6, 2024 · 2 revisions

Sometimes, it is necessary to change the CPACS definitions used in the local TiGL configuration. This might be done to overcome missing features which can be merged into the CPACS repository later or for simple testing reasons. To apply these changes, the cpacs_gen_input/cpacs_schema.xsd file in the local TiGL repository has to be adapted. Since the used schema of CPACS has, of course, direct impact on the source code of TiGL, several (generated) code files need to be changed and/or created from scratch. This happens via code generation but the process has to be initialized manually.

On this page, the necessary steps can be found to do so:

If not done before, TiGL has to be cloned, configured and installed on the local machine. Instructions for these initial steps can be found here.

  1. Change the directory to the TiGL root directory. After setting up and installing TiGL locally, the cpacs_tigl_gen submodule has to be activated within the TiGL repository:
cd </path/to/tigl>
git submodule init
git submodule update
  1. To sucessfully build the submodule, a special version of boost has to be used. For that, clone the initially created tigl-bld environment, activate it and install boost at version 1.71. The new environment's name, of course, can be chosen individually:
conda create --name tigl-bld_boost_1_71 --clone tigl-bld
activate tigl-bld_boost_1_71
conda install boost=1.71
  1. Now, switch to the submodule folder, create a build folder and move into it:
cd thirdparty/cpacs_gen/
mkdir build
cd build
  1. Localize the absolute path to the TiGL repository as it has to be passed during the configuration and configure the submodule:
cmake .. -DTIGL_PATH=</absolute/path/to/tigl>

All those steps before only have to be executed once when first initializing the generator. When generating the TiGL source code files again afterwards and everything mentioned above is available, the next steps are enough:

  1. Within the cpacs_tigl_gen build directory build the generate target. This automatically generates all the changes and new source code files:
make generate
  1. After generating, switch back to the TiGL build directory. Here, cmake has to be executed again, in order that the potentially new files are recognized. Now, TiGL can be built and the changes in the CPACS schema are applied.
cd </path/to/tigl>/build
cmake ..
make [install]
  1. As mentioned above: Repeat the steps 5 and 6 to regenerate the source code

Note: If TiGL does not compile, there might be some changes necessary elsewhere in the source code, since, e.g., object names or structures might differ from before. This is depending on the adaptions in cpacs_schema.xsd and cannot be described in general.