Cannot set-up simple mesh in C++ #12470
-
Could someone pls help explain what is wrong here - I use this code snippet
I then perform this check const std::string& r_variable_name = "DISTANCE"; which results in this error: terminate called after throwing an instance of 'Kratos::Exception' |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
The output of: std::cout << "model_part: " << rModelPart << "\n"; is: model_part: -Main- model part
|
Beta Was this translation helpful? Give feedback.
-
Also, trying to add elements more simply with rModelPart.CreateNewElement("Element2D3N", 1, {{1,2,3}}, p_elem_prop ); results in a segmentation fault. |
Beta Was this translation helpful? Give feedback.
-
How are you running this? |
Beta Was this translation helpful? Give feedback.
-
I should add I can run everything fine through the python interface so Kratos is correctly compiled. |
Beta Was this translation helpful? Give feedback.
-
Here is everything including the compilation script I use. I call a cpp function from fortran and I would like to set up a mesh in the cpp code based on the nodes and connectivity data that the f90 code provides. I would very much appreciate it if you could take a look - the key code is createmesh.cpp. I believe I linked although Kratos libs correctly but maybe not. |
Beta Was this translation helpful? Give feedback.
-
Hi loumalouomega - including the kernel and starting the code with this
has allowed me to progress - I can now set the nodes and elements in the convential way // Set the nodes USE
thank you very much indeed! |
Beta Was this translation helpful? Give feedback.
Looking at your code is impressive you were able to link the code to fortran and it almost worked. In addition to adding the dependencies with the path and so on, the kernel must be loaded. This is done usually with the python imports but in your case you should load the kernel in C++ manually. See "includes/kernel.h"