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

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

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

revision 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC revision 1802 by jfenwick, Tue Sep 23 01:03:29 2008 UTC
# Line 72  DataTagged::DataTagged(const FunctionSpa Line 72  DataTagged::DataTagged(const FunctionSpa
72    // not unit_tested tested yet    // not unit_tested tested yet
73    // It is not explicitly unit tested yet, but it is called from DataFactory    // It is not explicitly unit tested yet, but it is called from DataFactory
74    
75      if (!what.canTag())
76      {
77        throw DataException("Programming error - DataTag created with a non-taggable FunctionSpace.");
78      }
79    // copy the data    // copy the data
80    m_data=data;    m_data=data;
81    
# Line 100  DataTagged::DataTagged(const FunctionSpa Line 104  DataTagged::DataTagged(const FunctionSpa
104  {  {
105    // alternative constructor    // alternative constructor
106    
107      if (!what.canTag())
108      {
109        throw DataException("Programming error - DataTag created with a non-taggable FunctionSpace.");
110      }
111    
112    // copy the data    // copy the data
113    m_data=data;    m_data=data;
114    
# Line 149  DataTagged::DataTagged(const DataConstan Line 158  DataTagged::DataTagged(const DataConstan
158  {  {
159    // copy constructor    // copy constructor
160    
161      if (!other.getFunctionSpace().canTag())
162      {
163        throw DataException("Programming error - DataTag created with a non-taggable FunctionSpace.");
164      }
165    
166    // fill the default value with the constant value item from "other"    // fill the default value with the constant value item from "other"
167  //   const DataArrayView& value=other.getPointDataView();  //   const DataArrayView& value=other.getPointDataView();
168    int len = other.getNoValues();    int len = other.getNoValues();
# Line 177  DataTagged::DataTagged(const FunctionSpa Line 191  DataTagged::DataTagged(const FunctionSpa
191    }    }
192    
193    
194      if (!what.canTag())
195      {
196        throw DataException("Programming error - DataTag created with a non-taggable FunctionSpace.");
197      }
198    
199    if (tagsource!=0)    if (tagsource!=0)
200    {    {
201      int numtags=tagsource->getTagLookup().size();      int numtags=tagsource->getTagLookup().size();
# Line 201  DataTagged::DataTagged(const FunctionSpa Line 220  DataTagged::DataTagged(const FunctionSpa
220    }    }
221  }  }
222    
223    DataAbstract*
224    DataTagged::deepCopy()
225    {
226      return new DataTagged(*this);
227    }
228    
229  DataAbstract*  DataAbstract*
230  DataTagged::getSlice(const DataTypes::RegionType& region) const  DataTagged::getSlice(const DataTypes::RegionType& region) const
# Line 586  DataTagged::toString() const Line 609  DataTagged::toString() const
609  //   DataArrayView tempView(getPointDataView().getData(), getPointDataView().getShape());  //   DataArrayView tempView(getPointDataView().getData(), getPointDataView().getShape());
610    for (i=m_offsetLookup.begin();i!=m_offsetLookup.end();++i) {    for (i=m_offsetLookup.begin();i!=m_offsetLookup.end();++i) {
611      temp << "Tag(" << i->first << ")" << endl;      temp << "Tag(" << i->first << ")" << endl;
612      temp << pointToString(m_data,getShape(),i->second,empty);      temp << pointToString(m_data,getShape(),i->second,empty) << endl;
613  //     tempView.setOffset(i->second);  //     tempView.setOffset(i->second);
614  //     temp << tempView.toString() << endl;  //     temp << tempView.toString() << endl;
615    }    }
# Line 896  DataTagged::dump(const std::string fileN Line 919  DataTagged::dump(const std::string fileN
919     if ( rank >0 ) {     if ( rank >0 ) {
920         dims[0]=shape[0];         dims[0]=shape[0];
921         if (! (ncdims[0] = dataFile.add_dim("d0",shape[0])) )         if (! (ncdims[0] = dataFile.add_dim("d0",shape[0])) )
922              throw DataException("Error - DataTagged:: appending ncdimsion 0 to netCDF file failed.");              throw DataException("Error - DataTagged:: appending ncdimension 0 to netCDF file failed.");
923     }     }
924     if ( rank >1 ) {     if ( rank >1 ) {
925         dims[1]=shape[1];         dims[1]=shape[1];
926         if (! (ncdims[1] = dataFile.add_dim("d1",shape[1])) )         if (! (ncdims[1] = dataFile.add_dim("d1",shape[1])) )
927              throw DataException("Error - DataTagged:: appending ncdimsion 1 to netCDF file failed.");              throw DataException("Error - DataTagged:: appending ncdimension 1 to netCDF file failed.");
928     }     }
929     if ( rank >2 ) {     if ( rank >2 ) {
930         dims[2]=shape[2];         dims[2]=shape[2];
931         if (! (ncdims[2] = dataFile.add_dim("d2", shape[2])) )         if (! (ncdims[2] = dataFile.add_dim("d2", shape[2])) )
932              throw DataException("Error - DataTagged:: appending ncdimsion 2 to netCDF file failed.");              throw DataException("Error - DataTagged:: appending ncdimension 2 to netCDF file failed.");
933     }     }
934     if ( rank >3 ) {     if ( rank >3 ) {
935         dims[3]=shape[3];         dims[3]=shape[3];
936         if (! (ncdims[3] = dataFile.add_dim("d3", shape[3])) )         if (! (ncdims[3] = dataFile.add_dim("d3", shape[3])) )
937              throw DataException("Error - DataTagged:: appending ncdimsion 3 to netCDF file failed.");              throw DataException("Error - DataTagged:: appending ncdimension 3 to netCDF file failed.");
938     }     }
939     const DataTagged::DataMapType& thisLookup=getTagLookup();     const DataTagged::DataMapType& thisLookup=getTagLookup();
940     DataTagged::DataMapType::const_iterator i;     DataTagged::DataMapType::const_iterator i;

Legend:
Removed from v.1796  
changed lines
  Added in v.1802

  ViewVC Help
Powered by ViewVC 1.1.26