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

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

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

trunk/escript/src/Data/DataExpanded.cpp revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC trunk/escript/src/DataExpanded.cpp revision 580 by gross, Wed Mar 8 05:45:51 2006 UTC
# Line 13  Line 13 
13   ******************************************************************************   ******************************************************************************
14  */  */
15    
16  #include "escript/Data/DataException.h"  #include "DataExpanded.h"
17  #include "escript/Data/DataExpanded.h"  #include "DataException.h"
18  #include "escript/Data/DataConstant.h"  #include "DataConstant.h"
19  #include "escript/Data/DataTagged.h"  #include "DataTagged.h"
 #include "escript/Data/DataArrayView.h"  
20    
21  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
22    
 #include <iostream>  
   
23  using namespace std;  using namespace std;
24  using namespace boost::python;  using namespace boost::python;
25  using namespace boost;  using namespace boost;
# Line 148  DataExpanded::DataExpanded(const Functio Line 145  DataExpanded::DataExpanded(const Functio
145    : DataAbstract(what)    : DataAbstract(what)
146  {  {
147    //    //
148      // create the view of the data
149      initialise(shape,what.getNumSamples(),what.getNumDPPSample());
150      //
151    // copy the data in the correct format    // copy the data in the correct format
152    m_data.getData()=data;    m_data.getData()=data;
   //  
   // create the view of the data  
   DataArrayView tempView(m_data.getData(),shape);  
   setPointDataView(tempView);  
153  }  }
154    
155  DataExpanded::~DataExpanded()  DataExpanded::~DataExpanded()
# Line 468  DataExpanded::copyAll(const boost::pytho Line 464  DataExpanded::copyAll(const boost::pytho
464      }      }
465    }    }
466  }  }
467    void
468    DataExpanded::eigenvalues(DataAbstract* ev)
469    {
470      int numSamples = getNumSamples();
471      int numDataPointsPerSample = getNumDPPSample();
472      DataExpanded* temp_ev=dynamic_cast<DataExpanded*>(ev);
473      if (temp_ev==0) {
474        throw DataException("Error - DataExpanded::eigenvalues: casting to DataExpanded failed (propably a programming error).");
475      }
476      DataArrayView& thisView=getPointDataView();
477      DataArrayView& evView=ev->getPointDataView();
478      #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
479      for (int sampleNo = 0; sampleNo < numSamples; sampleNo++) {
480        for (int dataPointNo = 0; dataPointNo < numDataPointsPerSample; dataPointNo++) {
481             DataArrayView::eigenvalues(thisView,getPointOffset(sampleNo,dataPointNo),
482                                        evView,ev->getPointOffset(sampleNo,dataPointNo));
483        }
484      }
485    }
486    void
487    DataExpanded::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
488    {
489      int numSamples = getNumSamples();
490      int numDataPointsPerSample = getNumDPPSample();
491      DataExpanded* temp_ev=dynamic_cast<DataExpanded*>(ev);
492      if (temp_ev==0) {
493        throw DataException("Error - DataExpanded::eigenvalues_and_eigenvectors: casting to DataExpanded failed (propably a programming error).");
494      }
495      DataExpanded* temp_V=dynamic_cast<DataExpanded*>(V);
496      if (temp_V==0) {
497        throw DataException("Error - DataExpanded::eigenvalues_and_eigenvectors: casting to DataExpanded failed (propably a programming error).");
498      }
499      DataArrayView& thisView=getPointDataView();
500      DataArrayView& evView=ev->getPointDataView();
501      DataArrayView& VView=V->getPointDataView();
502      #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
503      for (int sampleNo = 0; sampleNo < numSamples; sampleNo++) {
504        for (int dataPointNo = 0; dataPointNo < numDataPointsPerSample; dataPointNo++) {
505             DataArrayView::eigenvalues_and_eigenvectors(thisView,getPointOffset(sampleNo,dataPointNo),
506                                                         evView,ev->getPointOffset(sampleNo,dataPointNo),
507                                                         VView,V->getPointOffset(sampleNo,dataPointNo),
508                                                         tol);
509        }
510      }
511    }
512    
513  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.155  
changed lines
  Added in v.580

  ViewVC Help
Powered by ViewVC 1.1.26