/[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

revision 682 by robwdcock, Mon Mar 27 02:43:09 2006 UTC revision 854 by gross, Thu Sep 21 05:29:42 2006 UTC
# Line 152  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 160  DataConstant::setSlice(const DataAbstrac Line 160  DataConstant::setSlice(const DataAbstrac
160    getPointDataView().copySliceFrom(tempDataConst->getPointDataView(),region_loop_range);    getPointDataView().copySliceFrom(tempDataConst->getPointDataView(),region_loop_range);
161  }  }
162    
 void  
 DataConstant::reshapeDataPoint(const DataArrayView::ShapeType& shape)  
 {  
   if (getPointDataView().getRank()!=0) {  
     stringstream temp;  
     temp << "Error - Can only reshape Data with data points of rank 0. "  
          << "This Data has data points with rank: " << getPointDataView().getRank();  
     throw DataException(temp.str());  
   }  
   int len = DataArrayView::noValues(shape);  
   m_data.resize(len,getPointDataView()(),len);  
   DataArrayView newView(m_data,shape);  
   setPointDataView(newView);  
 }  
   
163  int  int
164  DataConstant::archiveData(ofstream& archiveFile,  DataConstant::archiveData(ofstream& archiveFile,
165                            const DataArrayView::ValueType::size_type noValues) const                            const DataArrayView::ValueType::size_type noValues) const
# Line 190  DataConstant::extractData(ifstream& arch Line 175  DataConstant::extractData(ifstream& arch
175  }  }
176    
177  void  void
178    DataConstant::symmetric(DataAbstract* ev)
179    {
180      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
181      if (temp_ev==0) {
182        throw DataException("Error - DataConstant::symmetric: casting to DataConstant failed (propably a programming error).");
183      }
184      DataArrayView& thisView=getPointDataView();
185      DataArrayView& evView=ev->getPointDataView();
186      DataArrayView::symmetric(thisView,0,evView,0);
187    }
188    
189    void
190    DataConstant::nonsymmetric(DataAbstract* ev)
191    {
192      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
193      if (temp_ev==0) {
194        throw DataException("Error - DataConstant::nonsymmetric: casting to DataConstant failed (propably a programming error).");
195      }
196      DataArrayView& thisView=getPointDataView();
197      DataArrayView& evView=ev->getPointDataView();
198      DataArrayView::nonsymmetric(thisView,0,evView,0);
199    }
200    
201    void
202    DataConstant::trace(DataAbstract* ev, int axis_offset)
203    {
204      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
205      if (temp_ev==0) {
206        throw DataException("Error - DataConstant::trace: casting to DataConstant failed (propably a programming error).");
207      }
208      DataArrayView& thisView=getPointDataView();
209      DataArrayView& evView=ev->getPointDataView();
210      DataArrayView::trace(thisView,0,evView,0,axis_offset);
211    }
212    
213    void
214    DataConstant::swapaxes(DataAbstract* ev, int axis0, int axis1)
215    {
216      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
217      if (temp_ev==0) {
218        throw DataException("Error - DataConstant::swapaxes: casting to DataConstant failed (propably a programming error).");
219      }
220      DataArrayView& thisView=getPointDataView();
221      DataArrayView& evView=ev->getPointDataView();
222      DataArrayView::swapaxes(thisView,0,evView,0,axis0,axis1);
223    }
224    
225    void
226    DataConstant::transpose(DataAbstract* ev, int axis_offset)
227    {
228      DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);
229      if (temp_ev==0) {
230        throw DataException("Error - DataConstant::transpose: casting to DataConstant failed (propably a programming error).");
231      }
232      DataArrayView& thisView=getPointDataView();
233      DataArrayView& evView=ev->getPointDataView();
234      DataArrayView::transpose(thisView,0,evView,0,axis_offset);
235    }
236    
237    void
238  DataConstant::eigenvalues(DataAbstract* ev)  DataConstant::eigenvalues(DataAbstract* ev)
239  {  {
240    DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);    DataConstant* temp_ev=dynamic_cast<DataConstant*>(ev);

Legend:
Removed from v.682  
changed lines
  Added in v.854

  ViewVC Help
Powered by ViewVC 1.1.26