We will create input data using the Concepts Input Generator (CIG), which was written in Python. In another tutorial, we will load the input data into a C++
code. See Concepts tutorials for more tutorials.
Imagine you have a piece of code written in C++
and there are some parameters, which you want to modify after each run, e.g. you want to solve the Maxwell equations with various relative perimittivities or you want to try out different refinements of the mesh.
To avoid recompiling your whole code over and over again, it makes sense to encapsulate the definition of all parameters, which can vary, from the main code. Using CIG together with the class concepts::InOutParameters
is one possible way to achieve this.
First, let us define some inputs which we want to pass to our main code in C++
.
While the input parameters above use standard python classes, there is a special class for the mesh, which is also part of CIG.
Finally, we specify some refinement strategy: We perform one h-refinement, followed by two p-refinements and finally three hp-refinements towards the vertex with attribute number 777, which is the point p1=
(0,0) .
Now we initialize a cigProject.Project
object and write all the parameters above into this object
While the names above were arbitrarily chosen, the following two names are keywords (e.g. using the name 'some_mesh'
would not work).
With the following command, we finally generate our CIG input data, which consist of a cig-file and several dat-files for the mesh.
The Python code can be directly executed with the command
If nothing went wrong, there should be a cig-file and five dat-files in the directory, where the python code was executed.
Click here to see how to load the input data into a C++
code.