%module ForceGroup %{ #include "ForceGroup.h" #include using namespace std; %} %include "std_list.i" %include "../base/Real.h" %include "../base/simpleTypes.h" %include "../base/Vector3D.h" %include "../base/ConstraintValueType.h" %include "../base/ValueType.h" %include "../base/Value.h" %include "../base/Parameter.h" %include "../base/MakeableDefinition.h" %include "ForceGroup.h" %extend ProtoMol::ForceGroup { void addPythonForce(PyObject *force) { if(force != NULL) { self->myPythonForcesList.push_back(force); } } void lala(PyObject* p) { PyObject* func = PyDict_GetItemString(p, "evaluate"); if (func == NULL) cout << "WARNING: NULL PYTHON function" << endl; PyObject* args = PyTuple_New(0); if (args == NULL) cout << "WARNING: NULL PYTHON args" << endl; PyObject_CallObject(func, args); } /* void evaluatePythonForces(GenericTopology* topo, const Vector3DBlock* positions, const Vector3DBlock* velocities, Vector3DBlock* forces, ScalarStructure* energies) const { topo->uncacheCellList(); for(list::const_iterator currentForce=self->myPythonForcesList.begin(); currentForce!=self->myPythonForcesList.end(); ++currentForce) { if (currentForce == NULL) cout << "WARNING: NULL PYTHON force" << endl; PyObject* func = PyDict_GetItemString((*currentForce), "evaluate"); if (func == NULL) cout << "WARNING: NULL PYTHON function" << endl; PyObject* args = PyTuple_New(0); if (args == NULL) cout << "WARNING: NULL PYTHON args" << endl; PyObject_CallObject(func, args); } }*/ };