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

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

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

revision 1426 by trankine, Wed Feb 27 06:12:15 2008 UTC revision 1718 by gross, Thu Aug 21 05:50:11 2008 UTC
# Line 67  FunctionSpace::getDomain() const Line 67  FunctionSpace::getDomain() const
67    return *m_domain;    return *m_domain;
68  }  }
69    
70  const std::string &  std::string
71  FunctionSpace::toString() const  FunctionSpace::toString() const
72  {  {
73    std::stringstream temp;    std::stringstream temp;
74    temp << m_domain->functionSpaceTypeAsString(m_functionSpaceType)    temp << m_domain->functionSpaceTypeAsString(m_functionSpaceType)
75         << " on " << m_domain->getDescription();         << " on " << m_domain->getDescription();
76    
77    type_str = temp.str();    return temp.str();
   
   return type_str;  
78  }  }
79    
80    
# Line 90  FunctionSpace::toPyString() const Line 88  FunctionSpace::toPyString() const
88    temp << m_domain->functionSpaceTypeAsString(m_functionSpaceType)    temp << m_domain->functionSpaceTypeAsString(m_functionSpaceType)
89         << " on " << m_domain->getDescription();         << " on " << m_domain->getDescription();
90    
91    //toString();    return cvtr(temp.str());
   type_str = temp.str();  
   
   return cvtr(type_str);  
92  }  }
93  #endif  #endif
94    
# Line 134  FunctionSpace::getTagFromDataPointNo(int Line 129  FunctionSpace::getTagFromDataPointNo(int
129    return(tagNo);    return(tagNo);
130  }  }
131    
132    int FunctionSpace::getReferenceIDFromDataPointNo(int dataPointNo) const
133    {
134         //
135         // Get the number of samples and data-points per sample
136         int numSamples = getNumSamples();
137         int numDataPointsPerSample = getNumDPPSample();
138         int*referenceIDs= borrowSampleReferenceIDs();
139         int numDataPoints = numSamples * numDataPointsPerSample;
140    
141         if (numDataPointsPerSample==0) {
142            throw DataException("FunctionSpace::getReferenceIDFromDataPointNo error: no data-points associated with this object.");
143         }
144         if (dataPointNo<0 || dataPointNo>numDataPoints) {
145            throw DataException("FunctionSpace::getReferenceIDFromDataPointNo error: invalid data-point number supplied.");
146         }
147         int sampleNo = dataPointNo / numDataPointsPerSample;
148         return referenceIDs[sampleNo];
149    }
150    
151  int*  int*
152  FunctionSpace::borrowSampleReferenceIDs() const  FunctionSpace::borrowSampleReferenceIDs() const
153  {  {
# Line 198  FunctionSpace::setTags(const int newTag, Line 212  FunctionSpace::setTags(const int newTag,
212     }     }
213  }  }
214    
215    int
216    FunctionSpace::getNumberOfTagsInUse() const
217    {
218       return  m_domain->getNumberOfTagsInUse(m_functionSpaceType);
219    }
220    
221    int*
222    FunctionSpace::borrowListOfTagsInUse() const
223    {
224       return  m_domain->borrowListOfTagsInUse(m_functionSpaceType);
225    }
226    
227    
228    
229    
230    boost::python::list
231    FunctionSpace::getListOfTags() const
232    {
233      boost::python::list taglist;
234      int i;
235      int* tags=borrowListOfTagsInUse();
236      for (i=0;i<getNumberOfTagsInUse();++i) taglist.append(tags[i]);
237      return taglist;
238    }
239    
240  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.1426  
changed lines
  Added in v.1718

  ViewVC Help
Powered by ViewVC 1.1.26