~ubuntu-branches/ubuntu/quantal/python-demgengeo/quantal

« back to all changes in this revision

Viewing changes to Python/HexAggregateInsertGenerator3DPy.cc

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2011-11-18 21:47:18 UTC
  • Revision ID: package-import@ubuntu.com-20111118214718-4ysqm3dhpqwdd7gd
Tags: upstream-0.99~bzr106
ImportĀ upstreamĀ versionĀ 0.99~bzr106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////
 
2
//                                                         //
 
3
// Copyright (c) 2007-2011 by The University of Queensland //
 
4
// Earth Systems Science Computational Centre (ESSCC)      //
 
5
// http://www.uq.edu.au/esscc                              //
 
6
//                                                         //
 
7
// Primary Business: Brisbane, Queensland, Australia       //
 
8
// Licensed under the Open Software License version 3.0    //
 
9
// http://www.opensource.org/licenses/osl-3.0.php          //
 
10
//                                                         //
 
11
/////////////////////////////////////////////////////////////
 
12
 
 
13
#include <boost/version.hpp>
 
14
#include <iostream>
 
15
#include <sstream>
 
16
#include "HexAggregateInsertGenerator3DPy.h"
 
17
 
 
18
using namespace boost::python;
 
19
 
 
20
   using boost::python::arg;
 
21
   void exportHexAggregateInsertGenerator3D()
 
22
   {
 
23
     // Check that Boost 1.34.0 or higher is being used.
 
24
     // If so, disable auto-generation of C++ signatures for Epydoc
 
25
     // (which stumbles over indentation in the auto-generated strings).
 
26
     #if ((BOOST_VERSION / 100000 >= 1) \
 
27
         && (BOOST_VERSION / 100 % 1000 >= 34)) \
 
28
         || (BOOST_VERSION / 100000 >= 2)
 
29
       boost::python::docstring_options no_autogen(true,false);
 
30
     #endif
 
31
 
 
32
      class_<HexAggregateInsertGenerator3D, bases<InsertGenerator3D> >(
 
33
        "HexAggregateInsertGenerator3D",
 
34
        "A particle packing algorithm for filling L{AVolume3D} spaces with hexahedral aggregates of particles",
 
35
        init<>()
 
36
      )
 
37
      .def(init<const HexAggregateInsertGenerator3D &>())
 
38
      .def(
 
39
           init<double,double,int,int,double,bool>(
 
40
           ( arg("minRadius"), arg("maxRadius"), arg("insertFails"), arg("maxIterations"), arg("tolerance"),arg("seed") ),
 
41
          "Initialises a particle packer in preparation for filling a\n"
 
42
          "L{AVolume3D} with hexahedral aggregates whose bounding sphere radii are in the specified range.\n"
 
43
          "The algorithm consists of two stages: \n"
 
44
          "1) the L{AVolume3D} is packed with particles of a specified radius range,\n"
 
45
          "2) each particle is replaced with a hexahedral grain of particles of equal size\n"
 
46
          "@type minRadius: double\n"
 
47
          "@kwarg minRadius: the minimum radius of particles to pack\n"
 
48
          "@type maxRadius: double\n"
 
49
          "@kwarg maxRadius: the maximum radius of particles to pack\n"
 
50
          "@type insertFails: int\n"
 
51
          "@kwarg insertFails: the number of particle insertion failures before the packer terminates\n"
 
52
          "@type maxIterations: int\n"
 
53
          "@kwarg maxIterations: the maximum number of iterations of the solver\n"
 
54
          "@type tolerance: double\n"
 
55
          "@kwarg tolerance: the overlap tolerance permitted\n"
 
56
          "@type seed: bool\n"
 
57
          "@kwarg seed: randomize the random number generator if True\n"
 
58
          "@rtype: void\n"
 
59
        )
 
60
      )
 
61
      .def(
 
62
        "generatePacking",
 
63
        &HexAggregateInsertGenerator3D::generatePacking3,
 
64
        ( arg("volume"), arg("ntable"), arg("groupID")=0 ),
 
65
        "Generates a particle assembly to fill the specified volume with\n"
 
66
        "hexahedral aggregrates whose constituent particles have the specified particle tag\n"
 
67
        "@type volume: L{AVolume3D}\n"
 
68
        "@kwarg volume: the 3D volume to fill with particles\n"
 
69
        "@type ntable: L{MNTable3D}\n"
 
70
        "@kwarg ntable: the neighbours table particles are inserted into\n"
 
71
        "@type groupID: int\n"
 
72
        "@kwarg groupID: the group ID assigned to particles (default: 0)\n"
 
73
        "@rtype: void\n"
 
74
      )
 
75
      .def(
 
76
        "generatePacking",
 
77
        &HexAggregateInsertGenerator3D::generatePacking4,
 
78
        ( arg("volume"), arg("ntable"), arg("groupID")=0, arg("tag") ),
 
79
        "@type tag: int\n"
 
80
        "@kwarg tag: the tag assigned to the generated particles\n"
 
81
        " (optional if not followed by C{list})\n"
 
82
      )
 
83
      .def(
 
84
        "generatePackingMaxVolume",
 
85
        &HexAggregateInsertGenerator3D::generatePackingMaxVolume,
 
86
        ( arg("volume"), arg("ntable"), arg("groupID")=0, arg("tag"), arg("maxVolume") ),
 
87
        "Fill the specified L{AVolume3D} with particles until the accumulated particle volume exceeds the specified C{maxVolume}.\n"
 
88
        "@type maxVolume: float\n"
 
89
        "@kwarg maxVolume: the maximum cumulative volume of the inserted particles\n"
 
90
      )
 
91
      .def(self_ns::str(self))
 
92
      ;
 
93
    }
 
94