Including C++ code in python
I have a mesh generator, written in C++, which I have now linked with dolfin, using the MeshEditor class to construct
a mesh. This works, but I would like to be able to use it from python.
I have tried to use SWIG to create a module, but I don't know how to tell it that my new class inherits Mesh.
Here is a summary of my code... but maybe there is a better way to do this?
Chris
mymesh.i
========
%module mymesh
%{
/* Put header files here or function declarations like below */
#include "mymesh.h"
%}
/* mymesh.h */
namespace dolfin{
class Mymesh : public Mesh
{
public:
Mymesh();
};
}
mymesh.cpp
==========
#include "mymesh.h"
#include <dolfin/
#include <dolfin/
#include <dolfin.h>
using namespace dolfin;
.....
Mymesh::Mymesh() {
Mesheditor editor;
....
}
# swig -c++ -python mymesh.i
mymesh.i:11: Warning(401): Nothing known about base class 'Mesh'. Ignored.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Chris Richardson
- Solved:
- Last query:
- Last reply: