/[escript]/trunk/ripley/src/ripleycpp.cpp
ViewVC logotype

Diff of /trunk/ripley/src/ripleycpp.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5528 by sshaw, Wed Mar 11 03:48:47 2015 UTC revision 5575 by sshaw, Wed Apr 1 03:17:22 2015 UTC
# Line 501  BOOST_PYTHON_MODULE(ripleycpp) Line 501  BOOST_PYTHON_MODULE(ripleycpp)
501      scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;      scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;
502      scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;      scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;
503    
504      def("Brick", ripley::_brick, (arg("n0"),arg("n1"),arg("n2"),arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,      def("Brick", ripley::_brick, (arg("n0"),arg("n1"),arg("n2"),arg("l0")=1.0,
505          arg("d0")=-1,arg("d1")=-1,arg("d2")=-1,arg("diracPoints")=list(),arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr()),          arg("l1")=1.0,arg("l2")=1.0,arg("d0")=-1,arg("d1")=-1,arg("d2")=-1,
506  "Creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2].\n\n"          arg("diracPoints")=list(),arg("diracTags")=list(),
507  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"          arg("escriptworld")=escript::SubWorld_ptr()),
508  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"          "Creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2].\n\n"
509  ":param n2: number of elements in direction 2\n:type n2: ``int``\n"          ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
510  ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"          ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
511  ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"          ":param n2: number of elements in direction 2\n:type n2: ``int``\n"
512  ":param l2: length of side 2 or coordinate range of side 2\n:type l2: ``float`` or ``tuple``\n"          ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
513  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"          ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
514  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"          ":param l2: length of side 2 or coordinate range of side 2\n:type l2: ``float`` or ``tuple``\n"
515  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");          ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
516            ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"
517      def("Rectangle", ripley::_rectangle, (arg("n0"),arg("n1"),arg("l0")=1.0,arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1,arg("diracPoints")=list(),arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr()),          ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");
518  "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"  
519  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"      def("Rectangle", ripley::_rectangle, (arg("n0"),arg("n1"),arg("l0")=1.0,
520  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"          arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1,arg("diracPoints")=list(),
521  ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"          arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr()),
522  ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"          "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"
523  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"          ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
524  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");          ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
525            ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
526      def("MultiRectangle", ripley::_multirectangle, (arg("n0"),arg("n1"),arg("l0")=1.0,arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1,arg("diracPoints")=list(),arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr(), arg("multiplier")=1),          ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
527  "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"          ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
528  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"          ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");
529  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"  
530  ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"      def("MultiRectangle", ripley::_multirectangle, (arg("n0"),arg("n1"),
531  ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"          arg("l0")=1.0,arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1,
532  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"          arg("diracPoints")=list(),arg("diracTags")=list(),
533  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"          arg("escriptworld")=escript::SubWorld_ptr(), arg("multiplier")=1),
534  ":param multiplier: size of overlap\n:type multiplier: ``unsigned int``");          "Creates a rectangular mesh with n0 x n1 parent elements over the "
535            "rectangle [0,l0] x [0,l1], each parent element is divided ``multiplier`` times.\n\n"
536      def("MultiBrick", ripley::_multibrick, (arg("n0"),arg("n1"),arg("n2"),arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,          ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
537          arg("d0")=-1,arg("d1")=-1,arg("d2")=-1,arg("diracPoints")=list(),arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr(), arg("multiplier")=1),          ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
538  "Creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2].\n\n"          ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
539  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"          ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
540  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"          ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
541  ":param n2: number of elements in direction 2\n:type n2: ``int``\n"          ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"
542  ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"          ":param multiplier: size of overlap\n:type multiplier: ``unsigned int``");
543  ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"  
544  ":param l2: length of side 2 or coordinate range of side 2\n:type l2: ``float`` or ``tuple``\n"      def("MultiBrick", ripley::_multibrick, (arg("n0"),arg("n1"),arg("n2"),
545  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"          arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,arg("d0")=-1,arg("d1")=-1,
546  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"          arg("d2")=-1,arg("diracPoints")=list(),arg("diracTags")=list(),
547  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``"          arg("escriptworld")=escript::SubWorld_ptr(), arg("multiplier")=1),
548  ":param multiplier: size of overlap\n:type multiplier: ``unsigned int``");          "Creates a hexagonal mesh with n0 x n1 x n2 parent elements over the "
549            "brick [0,l0] x [0,l1] x [0,l2], each parent element is divided ``multiplier`` times.\n\n"
550            ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
551            ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
552            ":param n2: number of elements in direction 2\n:type n2: ``int``\n"
553            ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
554            ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
555            ":param l2: length of side 2 or coordinate range of side 2\n:type l2: ``float`` or ``tuple``\n"
556            ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
557            ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"
558            ":param d2: number of subdivisions in direction 2\n:type d2: ``int``"
559            ":param multiplier: size of overlap\n:type multiplier: ``unsigned int``");
560    
561      def("readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"),      def("readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"),
562                  arg("functionspace"), arg("shape"), arg("fill")=0.,                  arg("functionspace"), arg("shape"), arg("fill")=0.,
563                  arg("byteOrder"), arg("dataType"), arg("first"),                  arg("byteOrder"), arg("dataType"), arg("first"),
564                  arg("numValues"), arg("multiplier"), arg("reverse")),                  arg("numValues"), arg("multiplier"), arg("reverse")),
565  "Reads a binary Grid");              "Reads a binary Grid");
566  #ifdef USE_BOOSTIO  #ifdef USE_BOOSTIO
567      def("_readBinaryGridFromZipped", &ripley::readBinaryGridFromZipped, (arg("filename"),      def("_readBinaryGridFromZipped", &ripley::readBinaryGridFromZipped, (arg("filename"),
568                  arg("functionspace"), arg("shape"), arg("fill")=0.,                  arg("functionspace"), arg("shape"), arg("fill")=0.,
569                  arg("byteOrder"), arg("dataType"), arg("first"),                  arg("byteOrder"), arg("dataType"), arg("first"),
570                  arg("numValues"), arg("multiplier"), arg("reverse")),                  arg("numValues"), arg("multiplier"), arg("reverse")),
571  "Reads a binary Grid");              "Reads a binary Grid");
572  #endif  #endif
573      def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),      def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),
574                  arg("functionspace"), arg("shape"), arg("fill"), arg("first"),                  arg("functionspace"), arg("shape"), arg("fill"), arg("first"),
575                  arg("numValues"), arg("multiplier"), arg("reverse")),                  arg("numValues"), arg("multiplier"), arg("reverse")),
576  "Reads a grid from a netCDF file");              "Reads a grid from a netCDF file");
577    
578      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain>, boost::noncopyable >      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain>, boost::noncopyable >
579          ("RipleyDomain", "", no_init)          ("RipleyDomain", "", no_init)
# Line 574  BOOST_PYTHON_MODULE(ripleycpp) Line 585  BOOST_PYTHON_MODULE(ripleycpp)
585          .def("dump", &ripley::RipleyDomain::dump, args("filename"),          .def("dump", &ripley::RipleyDomain::dump, args("filename"),
586                  "Dumps the mesh to a file with the given name.")                  "Dumps the mesh to a file with the given name.")
587          .def("getGridParameters", &ripley::RipleyDomain::getGridParameters,          .def("getGridParameters", &ripley::RipleyDomain::getGridParameters,
588  "Returns the tuple (origin, spacing, elements) where the entries are tuples:\n"              "Returns the tuple (origin, spacing, elements) where the entries are tuples containing\n"
589  "``origin``=the coordinates of the domain's global origin,\n"              "    ``origin``  the coordinates of the domain's global origin,\n"
590  "``spacing``=the element size (=node spacing) of the domain,\n"              "    ``spacing``  the element size (node spacing) of the domain,\n"
591  "``elements``=the global number of elements in all dimensions\n\n"              "    ``elements``  the global number of elements in all dimensions\n\n"
592  ":rtype: ``tuple``")              ":rtype: ``tuple``")
593          .def("getDescription", &ripley::RipleyDomain::getDescription,          .def("getDescription", &ripley::RipleyDomain::getDescription,
594  ":return: a description for this domain\n:rtype: ``string``")              ":return: a description for this domain\n:rtype: ``string``")
595          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")
596          .def("getDataShape", &ripley::RipleyDomain::getDataShape, args("functionSpaceCode"),          .def("getDataShape", &ripley::RipleyDomain::getDataShape, args("functionSpaceCode"),
597  ":return: a pair (dps, ns) where dps=the number of data points per sample, and ns=the number of samples\n:rtype: ``tuple``")              ":return: a pair (dps, ns) where dps is the number of data points per sample, and ns is the number of samples\n"
598                ":rtype: ``tuple``")
599          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,
600  ":return: the number of data points summed across all MPI processes\n"              ":return: the number of data points summed across all MPI processes\n"
601  ":rtype: ``int``")              ":rtype: ``int``")
602          .def("addToSystem",&ripley::RipleyDomain::addToSystemFromPython,          .def("addToSystem",&ripley::RipleyDomain::addToSystemFromPython,
603              args("mat", "rhs", "data"),              args("mat", "rhs", "data"),
604              "adds a PDE to the system, results depend on domain\n\n"              "adds a PDE to the system, results depend on domain\n\n"
605              ":param mat:\n:type mat: `OperatorAdapter`\n"              ":param mat:\n:type mat: `OperatorAdapter`\n"
606              ":param rhs:\n:type rhs: `Data`\n"              ":param rhs:\n:type rhs: `Data`\n"
607              ":param data:\ntype data: `list`")              ":param data:\n:type data: `list`\n")
608          .def("addToRHS",&ripley::RipleyDomain::addToRHSFromPython,          .def("addToRHS",&ripley::RipleyDomain::addToRHSFromPython,
609              args("rhs", "data"),              args("rhs", "data"),
610              "adds a PDE onto the stiffness matrix mat and a rhs, "              "adds a PDE onto the stiffness matrix mat and a rhs, "
611              "results depends on domain\n\n"              "results depends on domain\n\n"
612              ":param rhs:\n:type rhs: `Data`\n"              ":param rhs:\n:type rhs: `Data`\n"
613              ":param data:\ntype data: `list`")              ":param data:\n:type data: `list`\n")
614          .def("createAssembler", &ripley::RipleyDomain::createAssemblerFromPython,          .def("createAssembler", &ripley::RipleyDomain::createAssemblerFromPython,
615              args("typename", "options"),              args("typename", "options"),
616              "request from the domain an assembler of the specified type, if "              "request from the domain an assembler of the specified type, if "
# Line 609  BOOST_PYTHON_MODULE(ripleycpp) Line 621  BOOST_PYTHON_MODULE(ripleycpp)
621              args("tp", "source", "data"),              args("tp", "source", "data"),
622              ":param tp:\n:type tp: `TransportProblemAdapter`\n"              ":param tp:\n:type tp: `TransportProblemAdapter`\n"
623              ":param source:\n:type source: `Data`\n"              ":param source:\n:type source: `Data`\n"
624              ":param data:\ntype data: `list`")              ":param data:\n:type data: `list`\n")
625          .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,          .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,
626  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),              args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),
627  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"              "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"
628  ":param row_blocksize:\n:type row_blocksize: ``int``\n"              ":param row_blocksize:\n:type row_blocksize: ``int``\n"
629  ":param row_functionspace:\n:type row_functionspace: `FunctionSpace`\n"              ":param row_functionspace:\n:type row_functionspace: `FunctionSpace`\n"
630  ":param column_blocksize:\n:type column_blocksize: ``int``\n"              ":param column_blocksize:\n:type column_blocksize: ``int``\n"
631  ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"              ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"
632  ":param type:\n:type type: ``int``"              ":param type:\n:type type: ``int``"
633  )              )
634          .def("newTransportProblem",&ripley::RipleyDomain::newTransportProblem,          .def("newTransportProblem",&ripley::RipleyDomain::newTransportProblem,
635  args("theta", "blocksize", "functionspace", "type"),              args("theta", "blocksize", "functionspace", "type"),
636  "creates a TransportProblemAdapter\n\n"              "creates a TransportProblemAdapter\n\n"
637  ":param theta:\n:type theta: ``float``\n"              ":param theta:\n:type theta: ``float``\n"
638  ":param blocksize:\n:type blocksize: ``int``\n"              ":param blocksize:\n:type blocksize: ``int``\n"
639  ":param functionspace:\n:type functionspace: `FunctionSpace`\n"              ":param functionspace:\n:type functionspace: `FunctionSpace`\n"
640  ":param type:\n:type type: ``int``"              ":param type:\n:type type: ``int``"
641  )              )
642          .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,          .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,
643  args("options"),              args("options"),
644  ":return: the identifier of the matrix type to be used for the global stiffness matrix when particular solver options are used.\n"              ":return: the identifier of the matrix type to be used for the global stiffness matrix when particular solver options are used.\n"
645  ":rtype: ``int``\n"              ":rtype: ``int``\n"
646  ":param options:\n:type options: `SolverBuddy`\n"              ":param options:\n:type options: `SolverBuddy`\n"
647  )              )
648          .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,          .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,
649  args("solver", "preconditioner", "package", "symmetry"),              args("solver", "preconditioner", "package", "symmetry"),
650  ":return: the identifier of the transport problem type to be used when a particular solver, preconditioner, package and symmetric matrix is used.\n"              ":return: the identifier of the transport problem type to be used when a particular solver, preconditioner, package and symmetric matrix is used.\n"
651  ":rtype: ``int``\n"              ":rtype: ``int``\n"
652  ":param solver:\n:type solver: ``int``\n"              ":param solver:\n:type solver: ``int``\n"
653  ":param preconditioner:\n:type preconditioner: ``int``\n"              ":param preconditioner:\n:type preconditioner: ``int``\n"
654  ":param package:\n:type package: ``int``\n"              ":param package:\n:type package: ``int``\n"
655  ":param symmetry:\n:type symmetry: ``int``"              ":param symmetry:\n:type symmetry: ``int``"
656  )              )
657          .def("getX",&ripley::RipleyDomain::getX, ":return: locations in the FEM nodes\n\n"          .def("getX",&ripley::RipleyDomain::getX, ":return: locations in the FEM nodes\n\n"
658  ":rtype: `Data`")              ":rtype: `Data`")
659          .def("getNormal",&ripley::RipleyDomain::getNormal,          .def("getNormal",&ripley::RipleyDomain::getNormal,
660  ":return: boundary normals at the quadrature point on the face elements\n"              ":return: boundary normals at the quadrature point on the face elements\n"
661  ":rtype: `Data`")              ":rtype: `Data`")
662          .def("getSize",&ripley::RipleyDomain::getSize,":return: the element size\n"          .def("getSize",&ripley::RipleyDomain::getSize,":return: the element size\n"
663  ":rtype: `Data`")              ":rtype: `Data`")
664          .def("setTagMap",&ripley::RipleyDomain::setTagMap,args("name","tag"),          .def("setTagMap",&ripley::RipleyDomain::setTagMap,args("name","tag"),
665  "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"              "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"
666  ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")              ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")
667          .def("getTag",&ripley::RipleyDomain::getTag,args("name"),":return: tag id for "          .def("getTag",&ripley::RipleyDomain::getTag,args("name"),":return: tag id for "
668  "``name``\n:rtype: ``string``")              "``name``\n:rtype: ``string``")
669          .def("isValidTagName",&ripley::RipleyDomain::isValidTagName,args("name"),          .def("isValidTagName",&ripley::RipleyDomain::isValidTagName,args("name"),
670  ":return: True if ``name`` corresponds to a tag, otherwise False\n:rtype: ``bool``")              ":return: True if ``name`` corresponds to a tag, otherwise False\n:rtype: ``bool``")
671          .def("showTagNames",&ripley::RipleyDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")          .def("showTagNames",&ripley::RipleyDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")
672          .def("getMPISize",&ripley::RipleyDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")          .def("getMPISize",&ripley::RipleyDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")
673          .def("getMPIRank",&ripley::RipleyDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")          .def("getMPIRank",&ripley::RipleyDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")

Legend:
Removed from v.5528  
changed lines
  Added in v.5575

  ViewVC Help
Powered by ViewVC 1.1.26