dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17824
[Question #103867]: Including C++ code in python
New question #103867 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/103867
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/mesh/MeshPartitioning.h>
#include <dolfin/mesh/MeshEditor.h>
#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.
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
Follow ups