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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
|
/////////////////////////////////////////////////////////////
// //
// Copyright (c) 2007-2017 by The University of Queensland //
// Centre for Geoscience Computing //
// http://earth.uq.edu.au/centre-geoscience-computing //
// //
// Primary Business: Brisbane, Queensland, Australia //
// Licensed under the Open Software License version 3.0 //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
/////////////////////////////////////////////////////////////
#include <boost/version.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include "MNTable2DPy.h"
using namespace std;
using namespace boost::python;
using boost::python::arg;
void exportMNTable2D()
{
// Disable autogeneration of C++ signatures (Boost 1.34.0 and higher)
// for Epydoc which stumbles over indentation in the automatically generated strings.
boost::python::docstring_options no_autogen(true,false);
class_<MNTable2D>(
"MNTable2D",
"A multi-group neighbour table for constructing 2D particle assemblies",
init<>()
)
.def(init<const MNTable2D &>())
.def(
init<Vector3&,Vector3&,double, unsigned int>(
( boost::python::arg("minPoint"), boost::python::arg("maxPoint"), boost::python::arg("gridSize"), boost::python::arg("numGroups")=1 ),
"Constructs a neighbour table with specified bounds, cell size and initial number of particle groups.\n"
"@type minPoint: L{Vector3}\n"
"@kwarg minPoint: lower-left point of the particle region\n"
"@type maxPoint: L{Vector3}\n"
"@kwarg maxPoint: upper-right point of the particle region\n"
"@type gridSize: double\n"
"@kwarg gridSize: the cell size for neighbour searches\n"
"@type numGroups: unsigned int\n"
"@kwarg numGroups: the initial number of groups (default: 1)\n"
)
)
.def(
"tagParticlesAlongLine",
&MNTable2D::tagParticlesAlongLine,
( boost::python::arg("line"), boost::python::arg("distance"), boost::python::arg("tag"), boost::python::arg("groupID")=0 ),
"Assigns the specified tag to all particles from group C{groupID}\n"
"that lie within the specified distance of the given line.\n"
"@type line: L{Line2D}\n"
"@kwarg line: the line along which to tag particles\n"
"@type distance: double\n"
"@kwarg distance: the maximum distance between tagged particles and the line\n"
"@type tag: int\n"
"@kwarg tag: the tag to assign particles\n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particles to tag (default: 0)\n"
"@rtype: void\n"
)
.def(
"tagParticlesAlongLineWithMask",
&MNTable2D::tagParticlesAlongLineWithMask,
( boost::python::arg("line"), boost::python::arg("distance"), boost::python::arg("tag"), boost::python::arg("mask"), boost::python::arg("groupID")=0 ),
"Assigns the specified tag to all particles from group C{groupID}\n"
"that lie within the specified distance of the given line.\n"
"@type line: L{Line2D}\n"
"@kwarg line: the line along which to tag particles\n"
"@type distance: double\n"
"@kwarg distance: the maximum distance between tagged particles and the line\n"
"@type tag: int\n"
"@kwarg tag: the tag to assign particles\n"
"@type mask: int\n"
"@kwarg mask: the mask - determines which bits of the tag are influenced \n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particles to tag (default: 0)\n"
"@rtype: void\n"
)
.def(
"tagParticlesAlongLineSegment",
&MNTable2D::tagParticlesAlongLineSegment,
( boost::python::arg("linesegment"), boost::python::arg("distance"), boost::python::arg("tag"), boost::python::arg("mask"), boost::python::arg("groupID")=0 ),
"Assigns the specified tag to all particles from group C{groupID}\n"
"that lie within the specified distance of the given line segment.\n"
"@type line: L{Line2D}\n"
"@kwarg line: the line along which to tag particles\n"
"@type distance: double\n"
"@kwarg distance: the maximum distance between tagged particles and the line\n"
"@type tag: int\n"
"@kwarg tag: the tag to assign particles\n"
"@type mask: int\n"
"@kwarg mask: the mask - determines which bits of the tag are influenced \n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particles to tag (default: 0)\n"
"@rtype: void\n"
)
.def(
"tagParticlesNear",
&MNTable2D::tagParticlesNear,
( boost::python::arg("point"), boost::python::arg("distance"), boost::python::arg("tag"), boost::python::arg("groupID")=0 ),
"Assigns the specified tag to all particles from group C{groupID}\n"
"that lie within the specified distance of the given point.\n"
"@type point: L{Vector3}\n"
"@kwarg point: the point around which to tag particles\n"
"@type distance: double\n"
"@kwarg distance: the maximum distance between tagged particles and the specified point\n"
"@type tag: int\n"
"@kwarg tag: the tag to assign particles\n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particles to tag (default: 0)\n"
"@rtype: void\n"
)
.def(
"tagClosestParticle",
&MNTable2D::tagClosestParticle,
( boost::python::arg("point"), boost::python::arg("tag"), boost::python::arg("groupID")=0 ),
"Assigns the specified tag to the particle which is closest to the given point.\n"
"@type point: L{Vector3}\n"
"@kwarg point: the point closest to the particle to be tagged\n"
"@type tag: int\n"
"@kwarg tag: the tag to assign closest particle\n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particle to tag (default: 0)\n"
"@rtype: void\n"
)
.def(
"breakBondsAlongLineSegment",
&MNTable2D::breakBondsAlongLineSegment,
( boost::python::arg("lineSegment"), boost::python::arg("distance"), boost::python::arg("tag"), boost::python::arg("groupID")=0 ),
"Breaks bonds within the specified distance of the given line segment.\n"
"Only bonds with the specified tag connecting particles in the\n"
"specified group will be broken.\n"
"@type lineSegment: L{LineSegment2D}\n"
"@kwarg lineSegment: the line segment along which to break bonds\n"
"@type distance: double\n"
"@kwarg distance: the maximum distance between bonds and the line segment\n"
"@type tag: int\n"
"@kwarg tag: the bond tag of bonds to break\n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particles whose bonds are broken (default: 0)\n"
"@rtype: void\n"
)
.def(
"generateBonds",
&MNTable2D::generateBonds,
(boost::python::arg("groupID")=0, boost::python::arg("tolerance"), boost::python::arg("bondID") ),
"Generates bonds between particle pairs separated by less than the specified tolerance\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles to bond together (default: 0)\n"
"@type tolerance: double\n"
"@kwarg tolerance: maximum distance separating bonded particles\n"
"@type bondID: int\n"
"@kwarg bondID: the bond ID to assign generated bonds\n"
"@rtype: void\n"
)
.def(
"generateBondsWithMask",
&MNTable2D::generateBondsWithMask,
(boost::python::arg("groupID")=0, boost::python::arg("tolerance"), boost::python::arg("bondID"), boost::python::arg("tag"), boost::python::arg("mask") ),
"Generates bonds between particle pairs separated by less than the specified tolerance.\n"
"A tag mask is used to select groups of particles to tag.\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles to bond together (default: 0)\n"
"@type tolerance: double\n"
"@kwarg tolerance: maximum distance separating bonded particles\n"
"@type bondID: int\n"
"@kwarg bondID: the bond ID to assign generated bonds\n"
"@type tag: int\n"
"@kwarg tag: the tag of particles to bond\n"
"@type mask: int\n"
"@kwarg mask: the bond mask\n"
"@rtype: void\n"
)
.def(
"generateBondsTaggedMasked",
&MNTable2D::generateBondsTaggedMasked,
(boost::python::arg("groupID")=0, boost::python::arg("tolerance"), boost::python::arg("bondID"), boost::python::arg("tag1"), boost::python::arg("mask1"), boost::python::arg("tag2"), boost::python::arg("mask2") ),
"Generates bonds between particle pairs separated by less than the specified tolerance.\n"
"A tag mask is used to select groups of particles to tag.\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles to bond together (default: 0)\n"
"@type tolerance: double\n"
"@kwarg tolerance: maximum distance separating bonded particles\n"
"@type bondID: int\n"
"@kwarg bondID: the bond ID to assign generated bonds\n"
"@type tag1: int\n"
"@kwarg tag1: the 1st particle tag\n"
"@type mask1: int\n"
"@kwarg mask1: the mask for the 1st particle tag\n"
"@type tag2: int\n"
"@kwarg tag2: the 2nd particle tag\n"
"@type mask2: int\n"
"@kwarg mask2: the mask for the 2nd particle tag\n"
"@rtype: void\n"
)
.def(
"generateRandomBonds",
&MNTable2D::generateRandomBonds,
(boost::python::arg("groupID"), boost::python::arg("tolerance"), boost::python::arg("probability"), boost::python::arg("bondID"), boost::python::arg("tag"), boost::python::arg("mask") ),
"Generates bonds between particle pairs separated by less than the specified tolerance.\n"
"Bonds are generated between particle pairs with the prescribed probability.\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles to bond together (default: 0)\n"
"@type tolerance: double\n"
"@kwarg tolerance: maximum distance separating bonded particles\n"
"@type probability: double\n"
"@kwarg probability: probability that a particle-pair is bonded (0.0 < probability < 1.0)\n"
"@type bondID: int\n"
"@kwarg bondID: the bond ID to assign generated bonds\n"
"@type tag: int\n"
"@kwarg tag: the tag of particles to bond\n"
"@type mask: int\n"
"@kwarg mask: the bond mask\n"
"@rtype: void\n"
)
.def(
"generateClusterBonds",
&MNTable2D::generateClusterBonds,
(boost::python::arg("groupID")=0, boost::python::arg("tolerance"), boost::python::arg("bondTag1"), boost::python::arg("bondTag2")),
"Generates bonds between particle pairs separated by less than the specified tolerance.\n"
"Bonds generated between particles having the same particle tag are given tag C{bondTag1}\n"
"and bonds generated between particles of differing tags are given tag C{bondTag2}\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles to bond together (default: 0)\n"
"@type tolerance: double\n"
"@kwarg tolerance: maximum distance separating bonded particles\n"
"@type bondTag1: int\n"
"@kwarg bondTag1: the bond tag for bonds between particles with the same particle tag\n"
"@type bondTag2: int\n"
"@kwarg bondTag2: the bond tag for bonds between particles with differing particle tags\n"
)
.def(
"getSumVolume",
&MNTable2D::getSumVolume,
( boost::python::arg("groupID")=0 ),
"Returns the sum of the particle areas in the specified group.\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles whose areas are summed (default: 0).\n"
"@rtype: double\n"
)
.def(
"getNumParticles",
&MNTable2D::getNrParticles,
( boost::python::arg("groupID")=0 ),
"Returns the number of the particles in the specified group.\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of the particles to count (default: 0).\n"
"@rtype: int\n"
)
.def(
"setOutputPrecision",
&MNTable2D::SetOutputPrecision,
( boost::python::arg("precision")),
"Set the number of significant digits for file output\n"
"@type precision: int\n"
"@kwarg precision: the number of significant digits (default: 10).\n"
)
.def(
"write",
&MNTable2D::write,
( boost::python::arg("fileName"), boost::python::arg("outputStyle") ),
"Writes the particle assembly and bonding information to the specified\n"
"file using the specified output style (0: debug; 1: geo; 2: vtk)\n"
"@type fileName: string\n"
"@kwarg fileName: the name of the file to write\n"
"@type outputStyle: int\n"
"@kwarg outputStyle: output style (0: debug; 1: geo; 2: vtk)\n"
"@rtype: void\n"
)
.def(
"tagParticlesToClosest",
&MNTable2D::tagParticlesToClosest,
( boost::python::arg("groupID1")=0, boost::python::arg("groupID2") ),
"Tags particles in C{groupID1} closest to spheres in C{groupID2}\n"
"@type groupID1: int\n"
"@kwarg groupID1: the group ID of particles to tag (default: 0).\n"
"@type groupID2: int\n"
"@kwarg groupID2: the group ID of closest spheres.\n"
)
.def(
"tagParticlesInVolume",
&MNTable2D::tagParticlesInVolume,
( boost::python::arg("volume"), boost::python::arg("tag"), boost::python::arg("groupID")=0 ),
"Assigns the specified tag to all particles from group C{groupID}\n"
"that lie within the specified volume.\n"
"@type volume: L{AVolume}\n"
"@kwarg volume: the volume within which to tag particles\n"
"@type tag: int\n"
"@kwarg tag: the tag to assign particles\n"
"@type groupID: unsigned int\n"
"@kwarg groupID: the group ID of particles to tag (default: 0)\n"
"@rtype: void\n"
)
.def(
"insert",
&MNTable2D::insert,
( boost::python::arg("sphere"), boost::python::arg("groupID")=0 ),
"Inserts sphere\n"
"@type sphere: L{Sphere}\n"
"@kwarg sphere: the sphere to insert\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of the inserted sphere (default: 0).\n"
)
.def(
"insertBond",
&MNTable2D::insertBond,
( boost::python::arg("Id1"), boost::python::arg("Id2"), boost::python::arg("tag") ),
"Inserts bond between particles with the specified particle IDs\n"
"@type Id1: int\n"
"@kwarg Id1: ID of first particle to bond\n"
"@type Id2: int\n"
"@kwarg Id2: ID of second particle to bond\n"
"@type tag: int\n"
"@kwarg tag: the bond tag to assign to the generated bond\n"
)
.def(
"removeTaggedParticles",
&MNTable2D::removeTagged,
(boost::python::arg("groupID")=0,boost::python::arg("tag"),boost::python::arg("mask")),
"Removes particles with given tag and mask\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of particles to remove (default: 0).\n"
"@type tag: int\n"
"@kwarg tag: the tag of particles to remove.\n"
"@type mask: int\n"
"@kwarg mask: the tag mask of particles to remove.\n"
)
.def(
"GrowNGroups",
&MNTable2D::GrowNGroups,
( boost::python::arg("numGroups") ),
"Expands the neighbour table to permit the specified number of particle groups\n"
"@type numGroups: int\n"
"@kwarg numGroups: number of groups to create\n"
"@rtype: void\n"
)
.def(
"getSphereListFromGroup",
&MNTable2D::getSphereListFromGroup,
( boost::python::arg("groupID")=0 ),
"Returns a python list of L{Sphere} objects with the specified group ID\n"
"@type groupID: int\n"
"@kwarg groupID: the group ID of spheres to return as a list (default: 0)\n"
"@rtype: boost::python::list\n"
)
.def(
"getBondList",
&MNTable2D::getBondList,
( boost::python::arg("groupID")=0 ),
"Returns a python list of bonds with the specified group ID as int-int pairs \n"
"@type groupID: int\n"
"@kwarg groupID: the bond tag\n"
"@rtype: boost::python::list\n"
)
.def(self_ns::str(self))
;
}
|