File: ShapeListPy.cc

package info (click to toggle)
python-demgengeo 0.99~bzr106-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,552 kB
  • sloc: cpp: 12,251; python: 1,251; makefile: 261; sh: 26
file content (71 lines) | stat: -rw-r--r-- 2,929 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/////////////////////////////////////////////////////////////
//                                                         //
// Copyright (c) 2007-2011 by The University of Queensland //
// Earth Systems Science Computational Centre (ESSCC)      //
// http://www.uq.edu.au/esscc                              //
//                                                         //
// Primary Business: Brisbane, Queensland, Australia       //
// Licensed under the Open Software License version 3.0    //
// http://www.opensource.org/licenses/osl-3.0.php          //
//                                                         //
/////////////////////////////////////////////////////////////

#include <boost/version.hpp>
#include "ShapeListPy.h"

using namespace boost::python;

void exportShapeList ()
{
  // Check that Boost 1.34.0 or higher is being used.
  // If so, disable auto-generation of C++ signatures for Epydoc
  // (which stumbles over indentation in the auto-generated strings).
  #if ((BOOST_VERSION / 100000 >= 1) \
      && (BOOST_VERSION / 100 % 1000 >= 34)) \
      || (BOOST_VERSION / 100000 >= 2)
    boost::python::docstring_options no_autogen(true,false);
  #endif

      class_<ShapeList>(
        "ShapeList",
        "A list of 3D shapes to be inserted into a packing by replacing spheres with scaled versions of the specified shape.\n"
	"Shapes may be read from a shape database file and the probability with which a given shape is inserted into a packing may be specified.\n",
        init<>()
      )
      .def(
        "addHexShape",
        &ShapeList::addHexShape,
        ( arg("bias") ),
        ( arg("random") ),
        "Adds a hexagonal aggregate to the L{ShapeList}\n"
        "@type bias: int\n"
        "@kwarg bias: How often the shape should be added\n"
        "@type random: int\n"
        "@kwarg random: 1 to randomly orientate this shape, 0 to have all constant\n"
      )
      .def(
        "addGenericShape",
        &ShapeList::addGenericShape,
        ( arg("db"), 
        arg("name"),
        arg("bias"),
        arg("random"),
        arg("particleTag"),
        arg("bondTag") ),
        "Adds a shape from a database file into the list\n"
        "@type db: string\n"
        "@kwarg db: The filename of the database file\n"
        "@type name: string\n"
        "@kwarg name: The name of the shape to be added, as per database file\n"
        "@type bias: int\n"
        "@kwarg bias: The bias of the new shape; in other words, how often it will be added\n"
        "@type random: int\n"
        "@kwarg random: Whether the shape should be orientated randomly at each insertion:\n"
        "0 for not random, 1 for always random\n"
        "@type particleTag: int\n"
        "@kwarg particleTag: the ID of each particle inside each inserted shape\n"
        "@type bondTag: int\n"
        "@kwarg bondTag: the bond ID of each bond internal to each shape\n"
      )
      ;
}