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

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

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

revision 115 by jgs, Fri Mar 4 07:12:47 2005 UTC revision 117 by jgs, Fri Apr 1 05:48:57 2005 UTC
# Line 33  FunctionSpace::FunctionSpace(): Line 33  FunctionSpace::FunctionSpace():
33    m_domain(static_cast<AbstractDomain*>(&m_nullDomainValue)),    m_domain(static_cast<AbstractDomain*>(&m_nullDomainValue)),
34    m_functionSpaceType(m_nullDomainValue.getFunctionCode())    m_functionSpaceType(m_nullDomainValue.getFunctionCode())
35  {  {
   //std::cout << "Called FunctionSpace DEFAULT constructor." << std::endl;  
36  }  }
37    
38  FunctionSpace::FunctionSpace(const AbstractDomain& domain, int functionSpaceType):  FunctionSpace::FunctionSpace(const AbstractDomain& domain,
39                                 int functionSpaceType):
40    m_domain(dynamic_cast<const AbstractDomain*>(&domain)),    m_domain(dynamic_cast<const AbstractDomain*>(&domain)),
41    m_functionSpaceType(functionSpaceType)    m_functionSpaceType(functionSpaceType)
42  {  {
   //std::cout << "Called FunctionSpace constructor." << std::endl;  
43    if (!m_domain->isValidFunctionSpaceType(functionSpaceType)) {    if (!m_domain->isValidFunctionSpaceType(functionSpaceType)) {
44      std::stringstream temp;      std::stringstream temp;
45      temp << "Invalid function space type: " << functionSpaceType      temp << "Invalid function space type: " << functionSpaceType
# Line 49  FunctionSpace::FunctionSpace(const Abstr Line 48  FunctionSpace::FunctionSpace(const Abstr
48    }    }
49  }  }
50    
51  std::pair<int,int> FunctionSpace::getDataShape() const  std::pair<int,int>
52    FunctionSpace::getDataShape() const
53  {  {
54    return m_domain->getDataShape(m_functionSpaceType);    return m_domain->getDataShape(m_functionSpaceType);
55  }  }
56    
57  int FunctionSpace::getTypeCode() const  int
58    FunctionSpace::getTypeCode() const
59  {  {
60    return  m_functionSpaceType;    return  m_functionSpaceType;
61  }  }
62    
63  const AbstractDomain& FunctionSpace::getDomain() const  const
64    AbstractDomain&
65    FunctionSpace::getDomain() const
66  {  {
67    return *m_domain;    return *m_domain;
68  }  }
69    
70  std::string FunctionSpace::toString() const  std::string
71    FunctionSpace::toString() const
72  {  {
73    std::stringstream temp;    std::stringstream temp;
74    temp << "Function space type: "    temp << "Function space type: "
# Line 73  std::string FunctionSpace::toString() co Line 77  std::string FunctionSpace::toString() co
77    return temp.str();    return temp.str();
78  }  }
79    
80  int FunctionSpace::getTagFromSampleNo(int sampleNo) const  int
81    FunctionSpace::getTagFromSampleNo(int sampleNo) const
82  {  {
83    return m_domain->getTagFromSampleNo(m_functionSpaceType,sampleNo);    return m_domain->getTagFromSampleNo(m_functionSpaceType,sampleNo);
84  }  }
85    
86  int FunctionSpace::getReferenceNoFromSampleNo(int sampleNo) const  int
87    FunctionSpace::getReferenceNoFromSampleNo(int sampleNo) const
88  {  {
89    return m_domain->getReferenceNoFromSampleNo(m_functionSpaceType,sampleNo);    return m_domain->getReferenceNoFromSampleNo(m_functionSpaceType,sampleNo);
90  }  }
91    
92  FunctionSpace& FunctionSpace::operator=(const FunctionSpace& other)  FunctionSpace&
93    FunctionSpace::operator=(const FunctionSpace& other)
94  {  {
95    //    //
96    // explicitly defined assignment operator to emphasise pointer copy    // explicitly defined assignment operator to emphasise pointer copy
# Line 93  FunctionSpace& FunctionSpace::operator=( Line 100  FunctionSpace& FunctionSpace::operator=(
100    return *this;    return *this;
101  }  }
102    
103  bool FunctionSpace::operator==(const FunctionSpace& other) const  bool
104    FunctionSpace::operator==(const FunctionSpace& other) const
105  {  {
106    return (other.m_domain==m_domain && other.m_functionSpaceType==m_functionSpaceType);    return (other.m_domain==m_domain && other.m_functionSpaceType==m_functionSpaceType);
107  }  }
108    
109  bool FunctionSpace::operator!=(const FunctionSpace& other) const  bool
110    FunctionSpace::operator!=(const FunctionSpace& other) const
111  {  {
112    return (!(other==*this));    return (!(other==*this));
113  }  }
114    
115  escript::Data FunctionSpace::getX() const  escript::Data
116    FunctionSpace::getX() const
117  {  {
118    Data out=escript::Vector(0,*this,true);    Data out=escript::Vector(0,*this,true);
119    getDomain().setToX(out);    getDomain().setToX(out);
120    return out;    return out;
121  }  }
122    
123  escript::Data FunctionSpace::getNormal() const  escript::Data
124    FunctionSpace::getNormal() const
125  {  {
126    Data out=escript::Vector(0,*this,true);    Data out=escript::Vector(0,*this,true);
127    getDomain().setToNormal(out);    getDomain().setToNormal(out);
128    return out;    return out;
129  }  }
130    
131  escript::Data FunctionSpace::getSize() const  escript::Data
132    FunctionSpace::getSize() const
133  {  {
134    Data out=escript::Scalar(0,*this,true);    Data out=escript::Scalar(0,*this,true);
135    getDomain().setToSize(out);    getDomain().setToSize(out);

Legend:
Removed from v.115  
changed lines
  Added in v.117

  ViewVC Help
Powered by ViewVC 1.1.26