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

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

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

revision 112 by jgs, Mon Feb 14 04:14:42 2005 UTC revision 113 by jgs, Mon Feb 28 07:06:33 2005 UTC
# Line 304  DataExpanded::setRefValue(int ref, Line 304  DataExpanded::setRefValue(int ref,
304                            const DataArray& value)                            const DataArray& value)
305  {  {
306    //    //
307    // Check number of samples and data-points per sample.    // Get the number of samples and data-points per sample.
308    int numSamples = getNumSamples();    int numSamples = getNumSamples();
309    int numDPPSample = getNumDPPSample();    int numDPPSample = getNumDPPSample();
   if (numDPPSample > 1) {  
     throw DataException("DataExpanded::setRefValue error: more than one DPPSample in this Data.");  
   }  
310    
311    //    //
312    // Determine the data-point which corresponds to this reference number.    // Determine the sample number which corresponds to this reference number.
313    int sampleNo = -1;    int sampleNo = -1;
314    int tempRef = -1;    int tempRef = -1;
315    for (int n=0; n<numSamples; n++) {    for (int n=0; n<numSamples; n++) {
# Line 326  DataExpanded::setRefValue(int ref, Line 323  DataExpanded::setRefValue(int ref,
323      throw DataException("DataExpanded::setRefValue error: invalid ref number supplied.");      throw DataException("DataExpanded::setRefValue error: invalid ref number supplied.");
324    }    }
325    
326    DataArrayView pointView = getDataPoint(sampleNo, 0);    for (int n=0; n<numDPPSample; n++) {
327        //
328    //      // Get each data-point in the sample in turn.
329    // Assign the values in the DataArray to this data-point.      DataArrayView pointView = getDataPoint(sampleNo, n);
330    pointView.copy(value.getView());  
331        //
332        // Assign the values in the DataArray to this data-point.
333        pointView.copy(value.getView());
334      }
335  }  }
336    
337  void  void
# Line 338  DataExpanded::getRefValue(int ref, Line 339  DataExpanded::getRefValue(int ref,
339                            DataArray& value)                            DataArray& value)
340  {  {
341    //    //
342    // Check number of samples and data-points per sample.    // Get the number of samples and data-points per sample.
343    int numSamples = getNumSamples();    int numSamples = getNumSamples();
344    int numDPPSample = getNumDPPSample();    int numDPPSample = getNumDPPSample();
   if (numDPPSample > 1) {  
     throw DataException("DataExpanded::getRefValue error: more than one DPPSample in this Data.");  
   }  
345    
346    //    //
347    // Determine the data-point which corresponds to this reference number    // Determine the sample number which corresponds to this reference number
348    int sampleNo = -1;    int sampleNo = -1;
349    int tempRef = -1;    int tempRef = -1;
350    for (int n=0; n<numSamples; n++) {    for (int n=0; n<numSamples; n++) {
# Line 360  DataExpanded::getRefValue(int ref, Line 358  DataExpanded::getRefValue(int ref,
358      throw DataException("DataExpanded::getRefValue error: invalid ref number supplied.");      throw DataException("DataExpanded::getRefValue error: invalid ref number supplied.");
359    }    }
360    
361      //
362      // Get the first data-point associated with this sample number.
363    DataArrayView pointView = getDataPoint(sampleNo, 0);    DataArrayView pointView = getDataPoint(sampleNo, 0);
364    
365    //    //

Legend:
Removed from v.112  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.26