/[escript]/trunk/escript/src/Data.cpp
ViewVC logotype

Diff of /trunk/escript/src/Data.cpp

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

trunk/esys2/escript/src/Data/Data.cpp revision 151 by jgs, Thu Sep 22 01:55:00 2005 UTC trunk/escript/src/Data.cpp revision 480 by jgs, Wed Feb 1 05:15:12 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2    
3  /*=============================================================================  /*=============================================================================
4    
5   ******************************************************************************   ******************************************************************************
# Line 15  Line 16 
16    
17  ******************************************************************************/  ******************************************************************************/
18    
19  #include "escript/Data/Data.h"  #include "Data.h"
20    
21    #include "DataExpanded.h"
22    #include "DataConstant.h"
23    #include "DataTagged.h"
24    #include "DataEmpty.h"
25    #include "DataArray.h"
26    #include "DataArrayView.h"
27    #include "DataProf.h"
28    #include "FunctionSpaceFactory.h"
29    #include "AbstractContinuousDomain.h"
30    #include "UnaryFuncs.h"
31    
 #include <iostream>  
32  #include <fstream>  #include <fstream>
33  #include <algorithm>  #include <algorithm>
34  #include <vector>  #include <vector>
 #include <exception>  
35  #include <functional>  #include <functional>
36  #include <math.h>  #include <math.h>
37    
38  #include <boost/python/str.hpp>  #include <boost/python/dict.hpp>
39  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
40  #include <boost/python/long.hpp>  #include <boost/python/long.hpp>
41    
 #include "escript/Data/DataException.h"  
 #include "escript/Data/DataExpanded.h"  
 #include "escript/Data/DataConstant.h"  
 #include "escript/Data/DataTagged.h"  
 #include "escript/Data/DataEmpty.h"  
 #include "escript/Data/DataArray.h"  
 #include "escript/Data/DataProf.h"  
 #include "escript/Data/FunctionSpaceFactory.h"  
 #include "escript/Data/AbstractContinuousDomain.h"  
 #include "escript/Data/UnaryFuncs.h"  
   
42  using namespace std;  using namespace std;
43  using namespace boost::python;  using namespace boost::python;
44  using namespace boost;  using namespace boost;
# Line 879  Data::integrate() const Line 878  Data::integrate() const
878      }      }
879    }    }
880    if (rank==2) {    if (rank==2) {
881      bp_array.resize(shape[0],shape[1]);         bp_array.resize(shape[0],shape[1]);
882      for (int i=0; i<shape[0]; i++) {         for (int i=0; i<shape[0]; i++) {
883        for (int j=0; j<shape[1]; j++) {           for (int j=0; j<shape[1]; j++) {
884          index = i + shape[0] * j;             index = i + shape[0] * j;
885          bp_array[i,j] = integrals[index];             bp_array[make_tuple(i,j)] = integrals[index];
886        }           }
887      }         }
888    }    }
889    if (rank==3) {    if (rank==3) {
890      bp_array.resize(shape[0],shape[1],shape[2]);      bp_array.resize(shape[0],shape[1],shape[2]);
# Line 893  Data::integrate() const Line 892  Data::integrate() const
892        for (int j=0; j<shape[1]; j++) {        for (int j=0; j<shape[1]; j++) {
893          for (int k=0; k<shape[2]; k++) {          for (int k=0; k<shape[2]; k++) {
894            index = i + shape[0] * ( j + shape[1] * k );            index = i + shape[0] * ( j + shape[1] * k );
895            bp_array[i,j,k] = integrals[index];            bp_array[make_tuple(i,j,k)] = integrals[index];
896          }          }
897        }        }
898      }      }
# Line 905  Data::integrate() const Line 904  Data::integrate() const
904          for (int k=0; k<shape[2]; k++) {          for (int k=0; k<shape[2]; k++) {
905            for (int l=0; l<shape[3]; l++) {            for (int l=0; l<shape[3]; l++) {
906              index = i + shape[0] * ( j + shape[1] * ( k + shape[2] * l ) );              index = i + shape[0] * ( j + shape[1] * ( k + shape[2] * l ) );
907              bp_array[i,j,k,l] = integrals[index];              bp_array[make_tuple(i,j,k,l)] = integrals[index];
908            }            }
909          }          }
910        }        }
# Line 1026  Data::atanh() const Line 1025  Data::atanh() const
1025  }  }
1026    
1027  Data  Data
1028  Data::log() const  Data::log10() const
1029  {  {
1030  #if defined DOPROF  #if defined DOPROF
1031    profData->unary++;    profData->unary++;
# Line 1035  Data::log() const Line 1034  Data::log() const
1034  }  }
1035    
1036  Data  Data
1037  Data::ln() const  Data::log() const
1038  {  {
1039  #if defined DOPROF  #if defined DOPROF
1040    profData->unary++;    profData->unary++;
# Line 1173  Data::minval() const Line 1172  Data::minval() const
1172  }  }
1173    
1174  Data  Data
 Data::length() const  
 {  
 #if defined DOPROF  
   profData->reduction2++;  
 #endif  
   Length len_func;  
   return dp_algorithm(len_func,0);  
 }  
   
 Data  
1175  Data::trace() const  Data::trace() const
1176  {  {
1177  #if defined DOPROF  #if defined DOPROF
# Line 1263  Data::calc_mindp(int& SampleNo, Line 1252  Data::calc_mindp(int& SampleNo,
1252  void  void
1253  Data::saveDX(std::string fileName) const  Data::saveDX(std::string fileName) const
1254  {  {
1255    getDomain().saveDX(fileName,*this);    boost::python::dict args;
1256      args["data"]=boost::python::object(this);
1257      getDomain().saveDX(fileName,args);
1258    return;    return;
1259  }  }
1260    
1261  void  void
1262  Data::saveVTK(std::string fileName) const  Data::saveVTK(std::string fileName) const
1263  {  {
1264    getDomain().saveVTK(fileName,*this);    boost::python::dict args;
1265      args["data"]=boost::python::object(this);
1266      getDomain().saveVTK(fileName,args);
1267    return;    return;
1268  }  }
1269    

Legend:
Removed from v.151  
changed lines
  Added in v.480

  ViewVC Help
Powered by ViewVC 1.1.26