/[escript]/trunk/ripley/src/RipleyDomain.cpp
ViewVC logotype

Diff of /trunk/ripley/src/RipleyDomain.cpp

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

revision 3744 by caltinay, Tue Dec 13 06:41:54 2011 UTC revision 3746 by caltinay, Thu Dec 15 00:02:22 2011 UTC
# Line 61  bool RipleyDomain::operator==(const Abst Line 61  bool RipleyDomain::operator==(const Abst
61  bool RipleyDomain::isValidFunctionSpaceType(int fsType) const  bool RipleyDomain::isValidFunctionSpaceType(int fsType) const
62  {  {
63      switch (fsType) {      switch (fsType) {
         case DegreesOfFreedom:  
         case ReducedDegreesOfFreedom:  
64          case Nodes:          case Nodes:
65          case ReducedNodes:          case ReducedNodes:
66          case Elements:          case Elements:
# Line 80  bool RipleyDomain::isValidFunctionSpaceT Line 78  bool RipleyDomain::isValidFunctionSpaceT
78  string RipleyDomain::functionSpaceTypeAsString(int fsType) const  string RipleyDomain::functionSpaceTypeAsString(int fsType) const
79  {  {
80      switch (fsType) {      switch (fsType) {
         case DegreesOfFreedom: return "Ripley_DegreesOfFreedom";  
         case ReducedDegreesOfFreedom: return "Ripley_ReducedDegreesOfFreedom";  
81          case Nodes: return "Ripley_Nodes";          case Nodes: return "Ripley_Nodes";
82          case ReducedNodes: return "Ripley_Reduced_Nodes";          case ReducedNodes: return "Ripley_Reduced_Nodes";
83          case Elements: return "Ripley_Elements";          case Elements: return "Ripley_Elements";
# Line 102  pair<int,int> RipleyDomain::getDataShape Line 98  pair<int,int> RipleyDomain::getDataShape
98          case Nodes:          case Nodes:
99          case ReducedNodes: //FIXME: reduced          case ReducedNodes: //FIXME: reduced
100              return pair<int,int>(1, getNumNodes());              return pair<int,int>(1, getNumNodes());
         case DegreesOfFreedom:  
         case ReducedDegreesOfFreedom: //FIXME: reduced  
             return pair<int,int>(1, getNumDOF());  
101          case Elements:          case Elements:
102              return pair<int,int>(ptsPerSample, getNumElements());              return pair<int,int>(ptsPerSample, getNumElements());
103          case FaceElements:          case FaceElements:
# Line 141  bool RipleyDomain::commonFunctionSpace(c Line 134  bool RipleyDomain::commonFunctionSpace(c
134     /*     /*
135      The idea is to use equivalence classes (i.e. types which can be      The idea is to use equivalence classes (i.e. types which can be
136      interpolated back and forth):      interpolated back and forth):
137      class 0: DOF <-> Nodes      class 0: Nodes
138      class 1: ReducedDOF <-> ReducedNodes      class 1: ReducedNodes
139      class 2: Points      class 2: Points
140      class 3: Elements      class 3: Elements
141      class 4: ReducedElements      class 4: ReducedElements
# Line 155  bool RipleyDomain::commonFunctionSpace(c Line 148  bool RipleyDomain::commonFunctionSpace(c
148      line 0: class 2      line 0: class 2
149      line 1: class 3,4      line 1: class 3,4
150      line 2: class 5,6      line 2: class 5,6
   
     For classes with multiple members (eg class 1) we have vars to record if  
     there is at least one instance. e.g. hasnodes is true if we have at least  
     one instance of Nodes.  
151      */      */
152      if (fs.empty())      if (fs.empty())
153          return false;          return false;
154      vector<bool> hasclass(7, false);      vector<bool> hasclass(7, false);
155      vector<int> hasline(3, 0);      vector<int> hasline(3, 0);
     bool hasnodes=false;  
     bool hasrednodes=false;  
156      for (size_t i=0; i<fs.size(); ++i) {      for (size_t i=0; i<fs.size(); ++i) {
157          switch (fs[i]) {          switch (fs[i]) {
158              case Nodes: hasnodes=true; // fall through              case Nodes:
             case DegreesOfFreedom:  
159                  hasclass[0]=true;                  hasclass[0]=true;
160                  break;                  break;
161              case ReducedNodes: hasrednodes=true; // fall through              case ReducedNodes:
             case ReducedDegreesOfFreedom:  
162                  hasclass[1]=true;                  hasclass[1]=true;
163                  break;                  break;
164              case Points:              case Points:
# Line 181  bool RipleyDomain::commonFunctionSpace(c Line 166  bool RipleyDomain::commonFunctionSpace(c
166                  hasclass[2]=true;                  hasclass[2]=true;
167                  break;                  break;
168              case Elements:              case Elements:
                 hasclass[3]=true;  
169                  hasline[1]=1;                  hasline[1]=1;
170                  break;                  break;
171              case ReducedElements:              case ReducedElements:
# Line 189  bool RipleyDomain::commonFunctionSpace(c Line 173  bool RipleyDomain::commonFunctionSpace(c
173                  hasline[1]=1;                  hasline[1]=1;
174                  break;                  break;
175              case FaceElements:              case FaceElements:
                 hasclass[5]=true;  
176                  hasline[2]=1;                  hasline[2]=1;
177                  break;                  break;
178              case ReducedFaceElements:              case ReducedFaceElements:
# Line 207  bool RipleyDomain::commonFunctionSpace(c Line 190  bool RipleyDomain::commonFunctionSpace(c
190      if (numLines > 1)      if (numLines > 1)
191          return false;          return false;
192      else if (numLines==1) {      else if (numLines==1) {
         // we have points  
193          if (hasline[0]==1)          if (hasline[0]==1)
194              resultcode=Points;              resultcode=Points;
195          else if (hasline[1]==1) {          else if (hasline[1]==1) {
# Line 223  bool RipleyDomain::commonFunctionSpace(c Line 205  bool RipleyDomain::commonFunctionSpace(c
205          }          }
206      } else { // numLines==0      } else { // numLines==0
207          if (hasclass[1])          if (hasclass[1])
208              // something from class 1              resultcode=ReducedNodes;
209              resultcode=(hasrednodes ? ReducedNodes : ReducedDegreesOfFreedom);          else
210          else // something from class 0              resultcode=Nodes;
             resultcode=(hasnodes ? Nodes : DegreesOfFreedom);  
211      }      }
212      return true;      return true;
213  }  }
# Line 236  bool RipleyDomain::probeInterpolationOnD Line 217  bool RipleyDomain::probeInterpolationOnD
217  {  {
218      if (fsType_target != Nodes &&      if (fsType_target != Nodes &&
219              fsType_target != ReducedNodes &&              fsType_target != ReducedNodes &&
             fsType_target != ReducedDegreesOfFreedom &&  
             fsType_target != DegreesOfFreedom &&  
220              fsType_target != Elements &&              fsType_target != Elements &&
221              fsType_target != ReducedElements &&              fsType_target != ReducedElements &&
222              fsType_target != FaceElements &&              fsType_target != FaceElements &&
# Line 251  bool RipleyDomain::probeInterpolationOnD Line 230  bool RipleyDomain::probeInterpolationOnD
230    
231      switch (fsType_source) {      switch (fsType_source) {
232          case Nodes:          case Nodes:
         case DegreesOfFreedom:  
233              return true;              return true;
234          case ReducedNodes:          case ReducedNodes:
235          case ReducedDegreesOfFreedom:              return (fsType_target != Nodes);
             return (fsType_target != Nodes &&  
                     fsType_target != DegreesOfFreedom);  
236          case Elements:          case Elements:
237              return (fsType_target==Elements ||              return (fsType_target==Elements ||
238                      fsType_target==ReducedElements);                      fsType_target==ReducedElements);
# Line 302  void RipleyDomain::interpolateOnDomain(e Line 278  void RipleyDomain::interpolateOnDomain(e
278      if (inFS==outFS) {      if (inFS==outFS) {
279          copyData(target, *const_cast<escript::Data*>(&in));          copyData(target, *const_cast<escript::Data*>(&in));
280      // not allowed: reduced->non-reduced      // not allowed: reduced->non-reduced
281      } else if ((inFS==ReducedNodes || inFS==ReducedDegreesOfFreedom)      } else if (inFS==ReducedNodes && outFS==Nodes) {
             && (outFS==Nodes || outFS==DegreesOfFreedom)) {  
282          throw RipleyException("interpolateOnDomain(): Cannot interpolate reduced data to non-reduced data.");          throw RipleyException("interpolateOnDomain(): Cannot interpolate reduced data to non-reduced data.");
283      } else if ((inFS==Elements && outFS==ReducedElements)      } else if ((inFS==Elements && outFS==ReducedElements)
284              || (inFS==FaceElements && outFS==ReducedFaceElements)) {              || (inFS==FaceElements && outFS==ReducedFaceElements)) {
# Line 311  void RipleyDomain::interpolateOnDomain(e Line 286  void RipleyDomain::interpolateOnDomain(e
286      } else {      } else {
287          switch (inFS) {          switch (inFS) {
288              case Nodes:              case Nodes:
289              case ReducedNodes: //FIXME: reduced              case ReducedNodes:
             case DegreesOfFreedom:  
             case ReducedDegreesOfFreedom: //FIXME: reduced  
290                  switch (outFS) {                  switch (outFS) {
291                      case Nodes:                      case Nodes:
292                      case ReducedNodes: //FIXME: reduced                      case ReducedNodes: //FIXME: reduced
293                      case DegreesOfFreedom:                          copyData(target, *const_cast<escript::Data*>(&in));
                     case ReducedDegreesOfFreedom: //FIXME: reduced  
                         // TODO  
294                          break;                          break;
295    
296                      case Elements:                      case Elements:
# Line 386  bool RipleyDomain::isCellOriented(int fs Line 357  bool RipleyDomain::isCellOriented(int fs
357  {  {
358      switch(fsType) {      switch(fsType) {
359          case Nodes:          case Nodes:
         case DegreesOfFreedom:  
         case ReducedDegreesOfFreedom:  
360              return false;              return false;
361          case Elements:          case Elements:
362          case FaceElements:          case FaceElements:
# Line 413  bool RipleyDomain::canTag(int fsType) co Line 382  bool RipleyDomain::canTag(int fsType) co
382          case FaceElements:          case FaceElements:
383          case ReducedFaceElements:          case ReducedFaceElements:
384              return true;              return true;
         case DegreesOfFreedom:  
         case ReducedDegreesOfFreedom:  
385          case Points:          case Points:
386              return false;              return false;
387          default:          default:
# Line 581  escript::ASM_ptr RipleyDomain::newSystem Line 548  escript::ASM_ptr RipleyDomain::newSystem
548      if (col_domain!=*this)      if (col_domain!=*this)
549          throw RipleyException("newSystemMatrix(): Domain of column function space does not match the domain of matrix generator");          throw RipleyException("newSystemMatrix(): Domain of column function space does not match the domain of matrix generator");
550      // is the function space type right?      // is the function space type right?
551      if (row_functionspace.getTypeCode()==ReducedDegreesOfFreedom)      if (row_functionspace.getTypeCode()==ReducedNodes)
552          reduceRowOrder=true;          reduceRowOrder=true;
553      else if (row_functionspace.getTypeCode()!=DegreesOfFreedom)      else if (row_functionspace.getTypeCode()!=Nodes)
554          throw RipleyException("newSystemMatrix(): Illegal function space type for system matrix rows");          throw RipleyException("newSystemMatrix(): Illegal function space type for system matrix rows");
555      if (column_functionspace.getTypeCode()==ReducedDegreesOfFreedom)      if (column_functionspace.getTypeCode()==ReducedNodes)
556          reduceColOrder=true;          reduceColOrder=true;
557      else if (column_functionspace.getTypeCode()!=DegreesOfFreedom)      else if (column_functionspace.getTypeCode()!=Nodes)
558          throw RipleyException("newSystemMatrix(): Illegal function space type for system matrix columns");          throw RipleyException("newSystemMatrix(): Illegal function space type for system matrix columns");
559    
560      // generate matrix      // generate matrix
# Line 852  dim_t RipleyDomain::getNumNodes() const Line 819  dim_t RipleyDomain::getNumNodes() const
819      throw RipleyException("getNumNodes() not implemented");      throw RipleyException("getNumNodes() not implemented");
820  }  }
821    
 dim_t RipleyDomain::getNumDOF() const  
 {  
     throw RipleyException("getNumDOF() not implemented");  
 }  
   
822  void RipleyDomain::assembleCoordinates(escript::Data& arg) const  void RipleyDomain::assembleCoordinates(escript::Data& arg) const
823  {  {
824      throw RipleyException("assembleCoordinates() not implemented");      throw RipleyException("assembleCoordinates() not implemented");

Legend:
Removed from v.3744  
changed lines
  Added in v.3746

  ViewVC Help
Powered by ViewVC 1.1.26