/[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 4657 by jfenwick, Thu Feb 6 06:12:20 2014 UTC revision 4738 by sshaw, Wed Mar 12 01:32:36 2014 UTC
# Line 79  escript::Data readBinaryGrid(std::string Line 79  escript::Data readBinaryGrid(std::string
79      return res;      return res;
80  }  }
81    
82    #ifdef USE_BOOSTIO
83    escript::Data readBinaryGridFromZipped(std::string filename, escript::FunctionSpace fs,
84            const object& pyShape, double fill, int byteOrder, int dataType,
85            const object& pyFirst, const object& pyNum, const object& pyMultiplier,
86            const object& pyReverse)
87    {
88        int dim=fs.getDim();
89        ReaderParameters params;
90    
91        params.first = extractPyArray<int>(pyFirst, "first", dim);
92        params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
93        params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
94        params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
95        params.byteOrder = byteOrder;
96        params.dataType = dataType;
97        std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
98    
99        const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
100        if (!dom)
101            throw RipleyException("Function space must be on a ripley domain");
102    
103        escript::Data res(fill, shape, fs, true);
104        dom->readBinaryGridFromZipped(res, filename, params);
105        return res;
106    }
107    #endif
108    
109  escript::Data readNcGrid(std::string filename, std::string varname,  escript::Data readNcGrid(std::string filename, std::string varname,
110          escript::FunctionSpace fs, const object& pyShape, double fill,          escript::FunctionSpace fs, const object& pyShape, double fill,
111          const object& pyFirst, const object& pyNum, const object& pyMultiplier,          const object& pyFirst, const object& pyNum, const object& pyMultiplier,
# Line 317  BOOST_PYTHON_MODULE(ripleycpp) Line 344  BOOST_PYTHON_MODULE(ripleycpp)
344                  arg("byteOrder"), arg("dataType"), arg("first"),                  arg("byteOrder"), arg("dataType"), arg("first"),
345                  arg("numValues"), arg("multiplier"), arg("reverse")),                  arg("numValues"), arg("multiplier"), arg("reverse")),
346  "Reads a binary Grid");  "Reads a binary Grid");
347    #ifdef USE_BOOSTIO
348        def("_readBinaryGridFromZipped", &ripley::readBinaryGridFromZipped, (arg("filename"),
349                    arg("functionspace"), arg("shape"), arg("fill")=0.,
350                    arg("byteOrder"), arg("dataType"), arg("first"),
351                    arg("numValues"), arg("multiplier"), arg("reverse")),
352    "Reads a binary Grid");
353    #endif
354      def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),      def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),
355                  arg("functionspace"), arg("shape"), arg("fill"), arg("first"),                  arg("functionspace"), arg("shape"), arg("fill"), arg("first"),
356                  arg("numValues"), arg("multiplier"), arg("reverse")),                  arg("numValues"), arg("multiplier"), arg("reverse")),
# Line 459  args("solver", "preconditioner", "packag Line 492  args("solver", "preconditioner", "packag
492          .def("MPIBarrier",&ripley::RipleyDomain::MPIBarrier,"Wait until all processes have reached this point")          .def("MPIBarrier",&ripley::RipleyDomain::MPIBarrier,"Wait until all processes have reached this point")
493          .def("onMasterProcessor",&ripley::RipleyDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");          .def("onMasterProcessor",&ripley::RipleyDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");
494    
495      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init)      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);
496    /*    
497      .def("randomFill", &ripley::Brick::randomFill,":return: random data\n:rtype: `Data`\n:param seed: pass zero to use system generated seed\n:type seed: `int`\n"      .def("randomFill", &ripley::Brick::randomFill,":return: random data\n:rtype: `Data`\n:param seed: pass zero to use system generated seed\n:type seed: `int`\n"
498  ":param details: more info about the type of randomness\nCurrently, the only acceptable value for this tuple is ('gaussian', r, s) where r is the radius of the"  ":param details: more info about the type of randomness\nCurrently, the only acceptable value for this tuple is ('gaussian', r, s) where r is the radius of the"
499  "guassian blur and s is the sigma parameter."  "guassian blur and s is the sigma parameter."
500      );      );
501      class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init)  */    
502        class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);
503    /*    
504      .def("randomFill", &ripley::Rectangle::randomFill,":return: random data\n:rtype: `Data`\n:param seed: pass zero to use system generated seed\n:type seed: `int`\n"      .def("randomFill", &ripley::Rectangle::randomFill,":return: random data\n:rtype: `Data`\n:param seed: pass zero to use system generated seed\n:type seed: `int`\n"
505  ":param details: more info about the type of randomness\nCurrently, the only acceptable value for this tuple is ('gaussian', r, s) where r is the radius of the"  ":param details: more info about the type of randomness\nCurrently, the only acceptable value for this tuple is ('gaussian', r, s) where r is the radius of the"
506  "guassian blur and s is the sigma parameter."  "guassian blur and s is the sigma parameter."
507      );      );
508    */    
509  }  }
510    

Legend:
Removed from v.4657  
changed lines
  Added in v.4738

  ViewVC Help
Powered by ViewVC 1.1.26