/[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 147 by jgs, Fri Aug 12 01:45:47 2005 UTC revision 149 by jgs, Thu Sep 1 03:31:39 2005 UTC
# Line 24  Line 24 
24  #include <sstream>  #include <sstream>
25    
26  using namespace std;  using namespace std;
27    
28  namespace escript {  namespace escript {
29    
30  //  //
31  // Create a null domain for use with a default constructed function space  // Create a null domain for use with any default-constructed function space
32  NullDomain FunctionSpace::m_nullDomainValue;  NullDomain FunctionSpace::m_nullDomainValue;
33    
34  FunctionSpace::FunctionSpace():  FunctionSpace::FunctionSpace():
# Line 44  FunctionSpace::FunctionSpace(const Abstr Line 45  FunctionSpace::FunctionSpace(const Abstr
45    if (!m_domain->isValidFunctionSpaceType(functionSpaceType)) {    if (!m_domain->isValidFunctionSpaceType(functionSpaceType)) {
46      std::stringstream temp;      std::stringstream temp;
47      temp << "Invalid function space type: " << functionSpaceType      temp << "Invalid function space type: " << functionSpaceType
48       <<" for domain: " << m_domain->getDescription();       << " for domain: " << m_domain->getDescription();
49      throw FunctionSpaceException(temp.str());      throw FunctionSpaceException(temp.str());
50    }    }
51  }  }
# Line 85  FunctionSpace::getTagFromSampleNo(int sa Line 86  FunctionSpace::getTagFromSampleNo(int sa
86  }  }
87    
88  int  int
89    FunctionSpace::getTagFromDataPointNo(int dataPointNo) const
90    {
91      //
92      // Get the number of samples and data-points per sample
93      int numSamples = getNumSamples();
94      int numDataPointsPerSample = getNumDPPSample();
95      int numDataPoints = numSamples * numDataPointsPerSample;
96    
97      if (numDataPointsPerSample==0) {
98        throw DataException("FunctionSpace::getTagFromDataPointNo error: no data-points associated with this object.");
99      }
100    
101      if (dataPointNo<0 || dataPointNo>numDataPoints) {
102        throw DataException("FunctionSpace::getTagFromDataPointNo error: invalid data-point number supplied.");
103      }
104    
105      //
106      // Determine the sample number which corresponds to this data-point number
107      int sampleNo = dataPointNo / numDataPointsPerSample;
108    
109      //
110      // Determine the tag number which corresponds to this sample number
111      int tagNo = getTagFromSampleNo(sampleNo);
112    
113      //
114      // return the tag number
115      return(tagNo);
116    }
117    
118    int
119  FunctionSpace::getReferenceNoFromSampleNo(int sampleNo) const  FunctionSpace::getReferenceNoFromSampleNo(int sampleNo) const
120  {  {
121    return m_domain->getReferenceNoFromSampleNo(m_functionSpaceType,sampleNo);    return m_domain->getReferenceNoFromSampleNo(m_functionSpaceType,sampleNo);
# Line 93  FunctionSpace::getReferenceNoFromSampleN Line 124  FunctionSpace::getReferenceNoFromSampleN
124  FunctionSpace&  FunctionSpace&
125  FunctionSpace::operator=(const FunctionSpace& other)  FunctionSpace::operator=(const FunctionSpace& other)
126  {  {
   //  
127    // explicitly defined assignment operator to emphasise pointer copy    // explicitly defined assignment operator to emphasise pointer copy
128    m_nullDomainValue=other.m_nullDomainValue;    m_nullDomainValue=other.m_nullDomainValue;
129    m_functionSpaceType=other.m_functionSpaceType;    m_functionSpaceType=other.m_functionSpaceType;

Legend:
Removed from v.147  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC 1.1.26