/[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/esys2/escript/src/Data/DataExpanded.cpp revision 126 by jgs, Fri Jul 22 03:53:08 2005 UTC trunk/escript/src/DataExpanded.cpp revision 615 by elspeth, Wed Mar 22 02:12:00 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2  /*  /*
3   ******************************************************************************   ************************************************************
4   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
6   *                                                                            *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
11   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
12  */  */
13    
14  #include "escript/Data/DataException.h"  #include "DataExpanded.h"
15  #include "escript/Data/DataExpanded.h"  #include "DataException.h"
16  #include "escript/Data/DataConstant.h"  #include "DataConstant.h"
17  #include "escript/Data/DataTagged.h"  #include "DataTagged.h"
 #include "escript/Data/DataArrayView.h"  
18    
19  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
20    
 #include <iostream>  
   
21  using namespace std;  using namespace std;
22  using namespace boost::python;  using namespace boost::python;
23  using namespace boost;  using namespace boost;
# Line 148  DataExpanded::DataExpanded(const Functio Line 143  DataExpanded::DataExpanded(const Functio
143    : DataAbstract(what)    : DataAbstract(what)
144  {  {
145    //    //
146      // create the view of the data
147      initialise(shape,what.getNumSamples(),what.getNumDPPSample());
148      //
149    // copy the data in the correct format    // copy the data in the correct format
150    m_data.getData()=data;    m_data.getData()=data;
   //  
   // create the view of the data  
   DataArrayView tempView(m_data.getData(),shape);  
   setPointDataView(tempView);  
151  }  }
152    
153  DataExpanded::~DataExpanded()  DataExpanded::~DataExpanded()
# Line 468  DataExpanded::copyAll(const boost::pytho Line 462  DataExpanded::copyAll(const boost::pytho
462      }      }
463    }    }
464  }  }
465    void
466    DataExpanded::eigenvalues(DataAbstract* ev)
467    {
468      int sampleNo,dataPointNo;
469      int numSamples = getNumSamples();
470      int numDataPointsPerSample = getNumDPPSample();
471      DataExpanded* temp_ev=dynamic_cast<DataExpanded*>(ev);
472      if (temp_ev==0) {
473        throw DataException("Error - DataExpanded::eigenvalues: casting to DataExpanded failed (propably a programming error).");
474      }
475      DataArrayView& thisView=getPointDataView();
476      DataArrayView& evView=ev->getPointDataView();
477      #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
478      for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
479        for (dataPointNo = 0; dataPointNo < numDataPointsPerSample; dataPointNo++) {
480             DataArrayView::eigenvalues(thisView,getPointOffset(sampleNo,dataPointNo),
481                                        evView,ev->getPointOffset(sampleNo,dataPointNo));
482        }
483      }
484    }
485    void
486    DataExpanded::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
487    {
488      int numSamples = getNumSamples();
489      int numDataPointsPerSample = getNumDPPSample();
490      int sampleNo,dataPointNo;
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 (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
504        for (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.126  
changed lines
  Added in v.615

  ViewVC Help
Powered by ViewVC 1.1.26