/[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 4687 by jfenwick, Wed Feb 19 00:03:29 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")),

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

  ViewVC Help
Powered by ViewVC 1.1.26