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

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

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

trunk/escript/src/Data/DataConstant.cpp revision 468 by jgs, Wed Jan 25 06:50:39 2006 UTC trunk/escript/src/DataConstant.cpp revision 775 by ksteube, Mon Jul 10 04:00:08 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/DataConstant.h"  #include "DataConstant.h"
15  #include "escript/Data/DataException.h"  #include "DataException.h"
16  #include "EsysAssert.h"  #include "esysUtils/EsysAssert.h"
17    
18  #include <iostream>  #include <iostream>
19  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
# Line 154  DataConstant::setSlice(const DataAbstrac Line 152  DataConstant::setSlice(const DataAbstrac
152    if (getPointDataView().getRank()!=region.size()) {    if (getPointDataView().getRank()!=region.size()) {
153      throw DataException("Error - Invalid slice region.");      throw DataException("Error - Invalid slice region.");
154    }    }
155    if (tempDataConst->getPointDataView().getRank()>0 and !value->getPointDataView().checkShape(shape)) {    if (tempDataConst->getPointDataView().getRank()>0 && !value->getPointDataView().checkShape(shape)) {
156      throw DataException (value->getPointDataView().createShapeErrorMessage(      throw DataException (value->getPointDataView().createShapeErrorMessage(
157                  "Error - Couldn't copy slice due to shape mismatch.",shape));                  "Error - Couldn't copy slice due to shape mismatch.",shape));
158    }    }
# Line 191  DataConstant::extractData(ifstream& arch Line 189  DataConstant::extractData(ifstream& arch
189    return(m_data.extractData(archiveFile, noValues));    return(m_data.extractData(archiveFile, noValues));
190  }  }
191    
192    void
193    DataConstant::symmetric(DataAbstract* ev)
194    {
195      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
196      if (temp_ev==0) {
197        throw DataException("Error - DataConstant::symmetric: casting to DataConstant failed (propably a programming error).");
198      }
199      DataArrayView& thisView=getPointDataView();
200      DataArrayView& evView=ev->getPointDataView();
201      DataArrayView::symmetric(thisView,0,evView,0);
202    }
203    
204    void
205    DataConstant::nonsymmetric(DataAbstract* ev)
206    {
207      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
208      if (temp_ev==0) {
209        throw DataException("Error - DataConstant::nonsymmetric: casting to DataConstant failed (propably a programming error).");
210      }
211      DataArrayView& thisView=getPointDataView();
212      DataArrayView& evView=ev->getPointDataView();
213      DataArrayView::nonsymmetric(thisView,0,evView,0);
214    }
215    
216    void
217    DataConstant::matrixtrace(DataAbstract* ev, int axis_offset)
218    {
219      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
220      if (temp_ev==0) {
221        throw DataException("Error - DataConstant::matrixtrace: casting to DataConstant failed (propably a programming error).");
222      }
223      DataArrayView& thisView=getPointDataView();
224      DataArrayView& evView=ev->getPointDataView();
225      DataArrayView::matrixtrace(thisView,0,evView,0,axis_offset);
226    }
227    
228    void
229    DataConstant::transpose(DataAbstract* ev, int axis_offset)
230    {
231      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
232      if (temp_ev==0) {
233        throw DataException("Error - DataConstant::transpose: casting to DataConstant failed (propably a programming error).");
234      }
235      DataArrayView& thisView=getPointDataView();
236      DataArrayView& evView=ev->getPointDataView();
237      DataArrayView::transpose(thisView,0,evView,0,axis_offset);
238    }
239    
240    void
241    DataConstant::eigenvalues(DataAbstract* ev)
242    {
243      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
244      if (temp_ev==0) {
245        throw DataException("Error - DataConstant::eigenvalues: casting to DataConstant failed (propably a programming error).");
246      }
247      DataArrayView& thisView=getPointDataView();
248      DataArrayView& evView=ev->getPointDataView();
249      DataArrayView::eigenvalues(thisView,0,evView,0);
250    }
251    void
252    DataConstant::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
253    {
254      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
255      if (temp_ev==0) {
256        throw DataException("Error - DataConstant::eigenvalues_and_eigenvectors: casting to DataConstant failed (propably a programming error).");
257      }
258      DataConstant* temp_V=dynamic_cast<DataConstant*>(V);
259      if (temp_V==0) {
260        throw DataException("Error - DataConstant::eigenvalues_and_eigenvectors: casting to DataConstant failed (propably a programming error).");
261      }
262      DataArrayView thisView=getPointDataView();
263      DataArrayView evView=ev->getPointDataView();
264      DataArrayView VView=V->getPointDataView();
265    
266      DataArrayView::eigenvalues_and_eigenvectors(thisView,0,evView,0,VView,tol);
267    }
268    
269    
270  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.468  
changed lines
  Added in v.775

  ViewVC Help
Powered by ViewVC 1.1.26