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

trunk/esys2/escript/src/Data/FunctionSpace.cpp revision 147 by jgs, Fri Aug 12 01:45:47 2005 UTC trunk/escript/src/FunctionSpace.cpp revision 615 by elspeth, Wed Mar 22 02:12:00 2006 UTC
# Line 1  Line 1 
1  /* $Id$ */  /* $Id$ */
2  /*  /*
3   ******************************************************************************   ************************************************************
4   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
6   *                                                                            *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
11   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
12  */  */
13    
14  #include "escript/Data/AbstractContinuousDomain.h"  #include "FunctionSpace.h"
15  #include "escript/Data/FunctionSpaceException.h"  #include "FunctionSpaceException.h"
16  #include "escript/Data/Data.h"  #include "Data.h"
17  #include "escript/Data/DataFactory.h"  #include "DataFactory.h"
   
 #include "escript/Data/FunctionSpace.h"  
18    
19  #include <iostream>  #include <iostream>
20  #include <sstream>  #include <sstream>
21    
22  using namespace std;  using namespace std;
23    
24  namespace escript {  namespace escript {
25    
26  //  //
27  // Create a null domain for use with a default constructed function space  // Create a null domain for use with any default-constructed function space
28  NullDomain FunctionSpace::m_nullDomainValue;  NullDomain FunctionSpace::m_nullDomainValue;
29    
30  FunctionSpace::FunctionSpace():  FunctionSpace::FunctionSpace():
# Line 44  FunctionSpace::FunctionSpace(const Abstr Line 41  FunctionSpace::FunctionSpace(const Abstr
41    if (!m_domain->isValidFunctionSpaceType(functionSpaceType)) {    if (!m_domain->isValidFunctionSpaceType(functionSpaceType)) {
42      std::stringstream temp;      std::stringstream temp;
43      temp << "Invalid function space type: " << functionSpaceType      temp << "Invalid function space type: " << functionSpaceType
44       <<" for domain: " << m_domain->getDescription();       << " for domain: " << m_domain->getDescription();
45      throw FunctionSpaceException(temp.str());      throw FunctionSpaceException(temp.str());
46    }    }
47  }  }
# Line 85  FunctionSpace::getTagFromSampleNo(int sa Line 82  FunctionSpace::getTagFromSampleNo(int sa
82  }  }
83    
84  int  int
85    FunctionSpace::getTagFromDataPointNo(int dataPointNo) const
86    {
87      //
88      // Get the number of samples and data-points per sample
89      int numSamples = getNumSamples();
90      int numDataPointsPerSample = getNumDPPSample();
91      int numDataPoints = numSamples * numDataPointsPerSample;
92    
93      if (numDataPointsPerSample==0) {
94        throw DataException("FunctionSpace::getTagFromDataPointNo error: no data-points associated with this object.");
95      }
96    
97      if (dataPointNo<0 || dataPointNo>numDataPoints) {
98        throw DataException("FunctionSpace::getTagFromDataPointNo error: invalid data-point number supplied.");
99      }
100    
101      //
102      // Determine the sample number which corresponds to this data-point number
103      int sampleNo = dataPointNo / numDataPointsPerSample;
104    
105      //
106      // Determine the tag number which corresponds to this sample number
107      int tagNo = getTagFromSampleNo(sampleNo);
108    
109      //
110      // return the tag number
111      return(tagNo);
112    }
113    
114    int
115  FunctionSpace::getReferenceNoFromSampleNo(int sampleNo) const  FunctionSpace::getReferenceNoFromSampleNo(int sampleNo) const
116  {  {
117    return m_domain->getReferenceNoFromSampleNo(m_functionSpaceType,sampleNo);    return m_domain->getReferenceNoFromSampleNo(m_functionSpaceType,sampleNo);
# Line 93  FunctionSpace::getReferenceNoFromSampleN Line 120  FunctionSpace::getReferenceNoFromSampleN
120  FunctionSpace&  FunctionSpace&
121  FunctionSpace::operator=(const FunctionSpace& other)  FunctionSpace::operator=(const FunctionSpace& other)
122  {  {
   //  
123    // explicitly defined assignment operator to emphasise pointer copy    // explicitly defined assignment operator to emphasise pointer copy
124    m_nullDomainValue=other.m_nullDomainValue;    m_nullDomainValue=other.m_nullDomainValue;
125    m_functionSpaceType=other.m_functionSpaceType;    m_functionSpaceType=other.m_functionSpaceType;

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

  ViewVC Help
Powered by ViewVC 1.1.26