/* Tell swig how to treat various types when moving them to and from python. Among other things, they tell swig how to convert collections of C++ objects (eg ExampleRestraints) into python lists and back. IMP_SWIG_OBJECT, IMP_SWIG_VALUE and IMP_SWIG_DECORATOR lines need to appear before any %include lines as well as any inline C++ code (or at least any such code which uses the types in question). */ %import "RMF.i" %{ #include "RMF.h" %} IMP_SWIG_OBJECT(IMP::example, ExampleRestraint, ExampleRestraints); IMP_SWIG_DECORATOR(IMP::example, ExampleDecorator, ExampleDecorators); IMP_SWIG_OBJECT(IMP::example, ExampleUnaryFunction, ExampleUnaryFunctions); IMP_SWIG_OBJECT(IMP::example, ExampleSingletonModifier, ExampleSingletonModifiers); IMP_SWIG_OBJECT(IMP::example, ExamplePairScore, ExamplePairScores); IMP_SWIG_OBJECT(IMP::example, ExampleSubsetFilterTable, ExampleSubsetFilterTables); IMP_SWIG_OBJECT(IMP::example, ExampleConstraint, ExampleConstraints); IMP_SWIG_VALUE_INSTANCE(IMP::example, ExampleTemplateClass3D, ExampleTemplateClassD, ExampleTemplateClass3Ds); IMP_SWIG_VALUE_TEMPLATE(IMP::example, ExampleTemplateClassD); /* One can add python methods to your module by putting code in %pythoncode blocks This function can be called as IMP.examples.say_hello(). */ %pythoncode %{ def create_model_and_particles(): m= IMP.Model() sc= IMP.container.ListSingletonContainer(m) b= IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0), IMP.algebra.Vector3D(10,10,10)) for i in range(0,100): p= IMP.Particle(m) sc.add_particle(p) d=IMP.core.XYZR.setup_particle(p, IMP.algebra.Sphere3D(IMP.algebra.get_random_vector_in(b), 1)) d.set_coordinates_are_optimized(True) return (m, sc) %} /* Wrap our own classes. Each header in the module should be listed here with a %include line.*/ %include "IMP/example/ExampleRestraint.h" %include "IMP/example/ExampleDecorator.h" %include "IMP/example/ExampleUnaryFunction.h" %include "IMP/example/ExampleRefCounted.h" %include "IMP/example/ExampleSingletonModifier.h" %include "IMP/example/ExampleTemplateClass.h" %include "IMP/example/ExamplePairScore.h" %include "IMP/example/ExampleSubsetFilterTable.h" %include "IMP/example/ExampleConstraint.h" %include "IMP/example/randomizing.h" %include "IMP/example/optimizing.h" %include "IMP/example/complex_assembly.h" %include "IMP/example/counting.h" %include "IMP/example/creating_restraints.h" namespace IMP { namespace example { /* Python doesn't natively support C++ templates, so you have to manually choose which template parameters you want to intantiate a template with. */ %template(ExampleTemplateClass3D) ExampleTemplateClassD<3>; } } /* Import the function from _randomize.py */ %pythoncode %{ from _randomize import * %}