/[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 4586 by jfenwick, Wed Dec 11 06:03:27 2013 UTC revision 4615 by caltinay, Mon Jan 13 05:05:33 2014 UTC
# Line 32  escript::Data readBinaryGrid(std::string Line 32  escript::Data readBinaryGrid(std::string
32          const object& pyShape, double fill, int byteOrder, int dataType)          const object& pyShape, double fill, int byteOrder, int dataType)
33  {  {
34      int dim=fs.getDim();      int dim=fs.getDim();
35      std::vector<int> first(dim), numValues(dim), multiplier(dim), shape;      GridParameters params;
36        std::vector<int> shape;
37    
38      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {
39          if (len(pyFirst)==dim) {          if (len(pyFirst)==dim) {
40              for (int i=0; i<dim; i++) {              for (int i=0; i<dim; i++) {
41                  first[i]=extract<int>(pyFirst[i]);                  params.first.push_back(extract<int>(pyFirst[i]));
42              }              }
43          } else          } else
44              throw RipleyException("Argument 'first' has wrong length");              throw RipleyException("Argument 'first' has wrong length");
# Line 47  escript::Data readBinaryGrid(std::string Line 48  escript::Data readBinaryGrid(std::string
48      if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {      if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {
49          if (len(pyNum)==dim) {          if (len(pyNum)==dim) {
50              for (int i=0; i<dim; i++) {              for (int i=0; i<dim; i++) {
51                  numValues[i]=extract<int>(pyNum[i]);                  params.numValues.push_back(extract<int>(pyNum[i]));
52              }              }
53          } else          } else
54              throw RipleyException("Argument 'numValues' has wrong length");              throw RipleyException("Argument 'numValues' has wrong length");
# Line 64  escript::Data readBinaryGrid(std::string Line 65  escript::Data readBinaryGrid(std::string
65      if (extract<tuple>(pyMultiplier).check() || extract<list>(pyMultiplier).check()) {      if (extract<tuple>(pyMultiplier).check() || extract<list>(pyMultiplier).check()) {
66          if (len(pyMultiplier)==dim) {          if (len(pyMultiplier)==dim) {
67              for (int i=0; i<dim; i++) {              for (int i=0; i<dim; i++) {
68                  multiplier[i]=extract<int>(pyMultiplier[i]);                  params.multiplier.push_back(extract<int>(pyMultiplier[i]));
69              }              }
70          } else          } else
71              throw RipleyException("Argument 'multiplier' has wrong length");              throw RipleyException("Argument 'multiplier' has wrong length");
# Line 78  escript::Data readBinaryGrid(std::string Line 79  escript::Data readBinaryGrid(std::string
79    
80      escript::Data res(fill, shape, fs, true);      escript::Data res(fill, shape, fs, true);
81    
82      dom->readBinaryGrid(res, filename, first, numValues, multiplier,      dom->readBinaryGrid(res, filename, params);
                         byteOrder, dataType);  
83      return res;      return res;
84  }  }
85    
# Line 88  escript::Data readNcGrid(std::string fil Line 88  escript::Data readNcGrid(std::string fil
88          const object& pyMultiplier, const object& pyShape, double fill=0.)          const object& pyMultiplier, const object& pyShape, double fill=0.)
89  {  {
90      int dim=fs.getDim();      int dim=fs.getDim();
91      std::vector<int> first(dim), numValues(dim), multiplier(dim), shape;      GridParameters params;
92        std::vector<int> shape;
93    
94      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {
95          if (len(pyFirst)==dim) {          if (len(pyFirst)==dim) {
96              for (int i=0; i<dim; i++) {              for (int i=0; i<dim; i++) {
97                  first[i]=extract<int>(pyFirst[i]);                  params.first.push_back(extract<int>(pyFirst[i]));
98              }              }
99          } else          } else
100              throw RipleyException("Argument 'first' has wrong length");              throw RipleyException("Argument 'first' has wrong length");
# Line 103  escript::Data readNcGrid(std::string fil Line 104  escript::Data readNcGrid(std::string fil
104      if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {      if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {
105          if (len(pyNum)==dim) {          if (len(pyNum)==dim) {
106              for (int i=0; i<dim; i++) {              for (int i=0; i<dim; i++) {
107                  numValues[i]=extract<int>(pyNum[i]);                  params.numValues.push_back(extract<int>(pyNum[i]));
108              }              }
109          } else          } else
110              throw RipleyException("Argument 'numValues' has wrong length");              throw RipleyException("Argument 'numValues' has wrong length");
# Line 113  escript::Data readNcGrid(std::string fil Line 114  escript::Data readNcGrid(std::string fil
114      if (extract<tuple>(pyMultiplier).check() || extract<list>(pyMultiplier).check()) {      if (extract<tuple>(pyMultiplier).check() || extract<list>(pyMultiplier).check()) {
115          if (len(pyMultiplier)==dim) {          if (len(pyMultiplier)==dim) {
116              for (int i=0; i<dim; i++) {              for (int i=0; i<dim; i++) {
117                  multiplier[i]=extract<int>(pyMultiplier[i]);                  params.multiplier.push_back(extract<int>(pyMultiplier[i]));
118              }              }
119          } else          } else
120              throw RipleyException("Argument 'multiplier' has wrong length");              throw RipleyException("Argument 'multiplier' has wrong length");
# Line 134  escript::Data readNcGrid(std::string fil Line 135  escript::Data readNcGrid(std::string fil
135    
136      escript::Data res(fill, shape, fs, true);      escript::Data res(fill, shape, fs, true);
137    
138      dom->readNcGrid(res, filename, varname, first, numValues, multiplier);      dom->readNcGrid(res, filename, varname, params);
139      return res;      return res;
140  }  }
141    

Legend:
Removed from v.4586  
changed lines
  Added in v.4615

  ViewVC Help
Powered by ViewVC 1.1.26