/[escript]/trunk/finley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /trunk/finley/src/CPPAdapter/MeshAdapter.cpp

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

trunk/esys2/finley/src/CPPAdapter/MeshAdapter.cpp revision 110 by jgs, Mon Feb 14 04:14:42 2005 UTC trunk/finley/src/CPPAdapter/MeshAdapter.cpp revision 532 by gross, Wed Feb 15 09:45:53 2006 UTC
# Line 12  Line 12 
12   *                                                                            *   *                                                                            *
13   ******************************************************************************   ******************************************************************************
14  */  */
15  extern "C" {  
16  #include "finley/finleyC/Finley.h"  #include "MeshAdapter.h"
17  #include "finley/finleyC/Assemble.h"  
18  #include "finley/finleyC/Mesh.h"  #include "Data.h"
19  #include "finley/finleyC/Finley.h"  #include "DataFactory.h"
 #include "finley/finleyC/System.h"  
 }  
 #include "finley/CPPAdapter/SystemMatrixAdapter.h"  
 #include "finley/CPPAdapter/MeshAdapter.h"  
 #include "finley/CPPAdapter/FinleyError.h"  
 #include "finley/CPPAdapter/FinleyAdapterException.h"  
 #include "escript/Data/FunctionSpaceFactory.h"  
 #include "escript/Data/Data.h"  
 #include "escript/Data/DataArrayView.h"  
 #include "escript/Data/FunctionSpace.h"  
 #include "escript/Data/DataFactory.h"  
 #include <iostream>  
 #include <vector>  
 #include <sstream>  
20    
21  using namespace std;  using namespace std;
22  using namespace escript;  using namespace escript;
23    
24  namespace finley {  namespace finley {
25    
 struct null_deleter  
 {  
   void operator()(void const *ptr) const  
   {  
   }  
 };  
   
26  //  //
27  // define the statics  // define the static constants
28  MeshAdapter::FunctionSpaceNamesMapType MeshAdapter::m_functionSpaceTypeNames;  MeshAdapter::FunctionSpaceNamesMapType MeshAdapter::m_functionSpaceTypeNames;
29  const int MeshAdapter::DegreesOfFreedom=FINLEY_DEGREES_OF_FREEDOM;  const int MeshAdapter::DegreesOfFreedom=FINLEY_DEGREES_OF_FREEDOM;
30  const int MeshAdapter::ReducedDegreesOfFreedom=FINLEY_REDUCED_DEGREES_OF_FREEDOM;  const int MeshAdapter::ReducedDegreesOfFreedom=FINLEY_REDUCED_DEGREES_OF_FREEDOM;
# Line 64  MeshAdapter::MeshAdapter(Finley_Mesh* fi Line 43  MeshAdapter::MeshAdapter(Finley_Mesh* fi
43    // for us.    // for us.
44    m_finleyMesh.reset(finleyMesh,null_deleter());    m_finleyMesh.reset(finleyMesh,null_deleter());
45  }  }
46    
47  //  //
48  // The copy constructor should just increment the use count  // The copy constructor should just increment the use count
49  MeshAdapter::MeshAdapter(const MeshAdapter& in):  MeshAdapter::MeshAdapter(const MeshAdapter& in):
# Line 150  int MeshAdapter::getContinuousFunctionCo Line 130  int MeshAdapter::getContinuousFunctionCo
130  {  {
131    return Nodes;    return Nodes;
132  }  }
133    
134  int MeshAdapter::getFunctionCode() const  int MeshAdapter::getFunctionCode() const
135  {  {
136    return Elements;    return Elements;
137  }  }
138    
139  int MeshAdapter::getFunctionOnBoundaryCode() const  int MeshAdapter::getFunctionOnBoundaryCode() const
140  {  {
141    return FaceElements;    return FaceElements;
142  }  }
143    
144  int MeshAdapter::getFunctionOnContactZeroCode() const  int MeshAdapter::getFunctionOnContactZeroCode() const
145  {  {
146    return ContactElementsZero;    return ContactElementsZero;
147  }  }
148    
149  int MeshAdapter::getFunctionOnContactOneCode() const  int MeshAdapter::getFunctionOnContactOneCode() const
150  {  {
151    return ContactElementsOne;    return ContactElementsOne;
# Line 171  int MeshAdapter::getSolutionCode() const Line 155  int MeshAdapter::getSolutionCode() const
155  {  {
156    return DegreesOfFreedom;    return DegreesOfFreedom;
157  }  }
158    
159  int MeshAdapter::getReducedSolutionCode() const  int MeshAdapter::getReducedSolutionCode() const
160  {  {
161    return ReducedDegreesOfFreedom;    return ReducedDegreesOfFreedom;
162  }  }
163    
164  int MeshAdapter::getDiracDeltaFunctionCode() const  int MeshAdapter::getDiracDeltaFunctionCode() const
165  {  {
166    return Points;    return Points;
167  }  }
168    
169  //  //
170  // returns a pointer to the tag list of samples of functionSpaceType  // returns a pointer to the tag list of samples of functionSpaceType
171  //  //
# Line 239  void MeshAdapter::getTagList(int functio Line 226  void MeshAdapter::getTagList(int functio
226      break;      break;
227    default:    default:
228      stringstream temp;      stringstream temp;
229      temp << "Error - Invalid function space type: "      temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
      << functionSpaceType << " for domain: " << getDescription();  
230      throw FinleyAdapterException(temp.str());      throw FinleyAdapterException(temp.str());
231      break;      break;
232    }    }
# Line 251  void MeshAdapter::getTagList(int functio Line 237  void MeshAdapter::getTagList(int functio
237    }    }
238    return;    return;
239  }  }
240    
241  //  //
242  // returns a pointer to the reference no list of samples of functionSpaceType  // returns a pointer to the reference no list of samples of functionSpaceType
243  //  //
# Line 311  void MeshAdapter::getReferenceNoList(int Line 298  void MeshAdapter::getReferenceNoList(int
298      break;      break;
299    default:    default:
300      stringstream temp;      stringstream temp;
301      temp << "Error - Invalid function space type: "      temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
      << functionSpaceType << " for domain: " << getDescription();  
302      throw FinleyAdapterException(temp.str());      throw FinleyAdapterException(temp.str());
303      break;      break;
304    }    }
# Line 333  int MeshAdapter::getDim() const Line 319  int MeshAdapter::getDim() const
319    checkFinleyError();    checkFinleyError();
320    return numDim;    return numDim;
321  }  }
322    
323  //  //
324  // return the number of data points per sample and the number of samples  // return the number of data points per sample and the number of samples
325  // needed to represent data on a parts of the mesh.  // needed to represent data on a parts of the mesh.
# Line 391  pair<int,int> MeshAdapter::getDataShape( Line 378  pair<int,int> MeshAdapter::getDataShape(
378             break;             break;
379        default:        default:
380          stringstream temp;          stringstream temp;
381          temp << "Error - Invalid function space type: "          temp << "Error - Invalid function space type: " << functionSpaceCode << " for domain: " << getDescription();
          << functionSpaceCode << " for domain: " << getDescription();  
382          throw FinleyAdapterException(temp.str());          throw FinleyAdapterException(temp.str());
383          break;          break;
384        }        }
385        return pair<int,int>(numDataPointsPerSample,numSamples);        return pair<int,int>(numDataPointsPerSample,numSamples);
386  }  }
387    
388  //  //
389  // adds linear PDE of second order into a given stiffness matrix and right hand side:  // adds linear PDE of second order into a given stiffness matrix and right hand side:
390  //  //
391  void MeshAdapter::addPDEToSystem(  void MeshAdapter::addPDEToSystem(
392                       SystemMatrixAdapter& mat, Data& rhs,                       SystemMatrixAdapter& mat, escript::Data& rhs,
393                       const Data& A, const Data& B, const Data& C,const  Data& D,const  Data& X,const  Data& Y,                       const escript::Data& A, const escript::Data& B, const escript::Data& C,const  escript::Data& D,const  escript::Data& X,const  escript::Data& Y,
394                       const Data& d, const Data& y,                       const escript::Data& d, const escript::Data& y,
395                       const Data& d_contact,const Data& y_contact) const                       const escript::Data& d_contact,const escript::Data& y_contact) const
396  {  {
397     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
398     Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,mat.getFinley_SystemMatrix(),&(rhs.getDataC()),     Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,mat.getPaso_SystemMatrix(),&(rhs.getDataC()),
399                         &(A.getDataC()),&(B.getDataC()),&(C.getDataC()),&(D.getDataC()),&(X.getDataC()),&(Y.getDataC()));                         &(A.getDataC()),&(B.getDataC()),&(C.getDataC()),&(D.getDataC()),&(X.getDataC()),&(Y.getDataC()));
400     checkFinleyError();     checkFinleyError();
401     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,
402                    mat.getFinley_SystemMatrix(),                    mat.getPaso_SystemMatrix(),
403                    &(rhs.getDataC()),                    &(rhs.getDataC()),
404                                    &(d.getDataC()),&(y.getDataC()),                                    &(d.getDataC()),&(y.getDataC()),
405                                    Finley_Assemble_handelShapeMissMatch_Mean_out);                                    Finley_Assemble_handelShapeMissMatch_Mean_out);
406     checkFinleyError();     checkFinleyError();
407     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->ContactElements,
408                    mat.getFinley_SystemMatrix(),                    mat.getPaso_SystemMatrix(),
409                    &(rhs.getDataC()),                    &(rhs.getDataC()),
410                                    &(d_contact.getDataC()),                                    &(d_contact.getDataC()),
411                    &(y_contact.getDataC()),                    &(y_contact.getDataC()),
412                                    Finley_Assemble_handelShapeMissMatch_Step_out);                                    Finley_Assemble_handelShapeMissMatch_Step_out);
413     checkFinleyError();     checkFinleyError();
414  }  }
415    
416  //  //
417  // adds linear PDE of second order into the right hand side only  // adds linear PDE of second order into the right hand side only
418  //  //
419  void MeshAdapter::addPDEToRHS( Data& rhs,  void MeshAdapter::addPDEToRHS( escript::Data& rhs,
420                       const  Data& X,const  Data& Y, const Data& y, const Data& y_contact) const                       const  escript::Data& X,const  escript::Data& Y, const escript::Data& y, const escript::Data& y_contact) const
421  {  {
422     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
423     Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,0,&(rhs.getDataC()),0,0,0,0,&(X.getDataC()),&(Y.getDataC()));  
424       // Finley_Assemble_PDE_RHS(mesh->Nodes,mesh->Elements,&(rhs.getDataC()),&(X.getDataC()),&(Y.getDataC()));
425       Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,0,&(rhs.getDataC()),0,0,0,0,&(X.getDataC()),&(Y.getDataC()));
426     checkFinleyError();     checkFinleyError();
427     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,0,&(rhs.getDataC()),0,&(y.getDataC()),  
428                                    Finley_Assemble_handelShapeMissMatch_Mean_out);     // Finley_Assemble_RobinCondition_RHS(mesh->Nodes,mesh->FaceElements,&(rhs.getDataC()),&(y.getDataC()),Finley_Assemble_handelShapeMissMatch_Mean_out);
429  // cout << "Calling :addPDEToRHS." << endl;     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,0,&(rhs.getDataC()),0,&(y.getDataC()),Finley_Assemble_handelShapeMissMatch_Mean_out);
430    
431     checkFinleyError();     checkFinleyError();
432     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,0,&(rhs.getDataC()),0,&(y_contact.getDataC()),     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->ContactElements,0,&(rhs.getDataC()),0,&(y_contact.getDataC()),Finley_Assemble_handelShapeMissMatch_Step_out);
433                                    Finley_Assemble_handelShapeMissMatch_Step_out);     // Finley_Assemble_RobinCondition_RHS(mesh->Nodes,mesh->ContactElements,&(rhs.getDataC()),&(y_contact.getDataC()),Finley_Assemble_handelShapeMissMatch_Step_out);
 // cout << "Calling :addPDEToRHS." << endl;  
434     checkFinleyError();     checkFinleyError();
435  }  }
436    
437  //  //
438  // interpolates data between different function spaces:  // interpolates data between different function spaces:
439  //  //
440  void MeshAdapter::interpolateOnDomain(Data& target,const Data& in) const  void MeshAdapter::interpolateOnDomain(escript::Data& target,const escript::Data& in) const
441  {  {
442    const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(in.getFunctionSpace().getDomain());    const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(in.getFunctionSpace().getDomain());
443    const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());    const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());
# Line 480  void MeshAdapter::interpolateOnDomain(Da Line 471  void MeshAdapter::interpolateOnDomain(Da
471                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));
472                 break;                 break;
473             default:             default:
474                 Finley_ErrorCode=TYPE_ERROR;                 stringstream temp;
475                 sprintf(Finley_ErrorMsg,"Interpolation on Domain: Finley does not know anything about function space type %d",target.getFunctionSpace().getTypeCode());                 temp << "Error - Interpolation on Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
476                   throw FinleyAdapterException(temp.str());
477                 break;                 break;
478          }          }
479          break;          break;
# Line 489  void MeshAdapter::interpolateOnDomain(Da Line 481  void MeshAdapter::interpolateOnDomain(Da
481          if (target.getFunctionSpace().getTypeCode()==Elements) {          if (target.getFunctionSpace().getTypeCode()==Elements) {
482             Finley_Assemble_CopyElementData(mesh->Elements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Elements,&(target.getDataC()),&(in.getDataC()));
483          } else {          } else {
484             Finley_ErrorCode=TYPE_ERROR;             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");
            sprintf(Finley_ErrorMsg,"No interpolation with data on elements possible.");  
485          }          }
486          break;          break;
487       case(FaceElements):       case(FaceElements):
488          if (target.getFunctionSpace().getTypeCode()==FaceElements) {          if (target.getFunctionSpace().getTypeCode()==FaceElements) {
489             Finley_Assemble_CopyElementData(mesh->FaceElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->FaceElements,&(target.getDataC()),&(in.getDataC()));
490          } else {          } else {
491             Finley_ErrorCode=TYPE_ERROR;             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");
            sprintf(Finley_ErrorMsg,"No interpolation with data on face elements possible.");  
492             break;             break;
493         }         }
494       case(Points):       case(Points):
495          if (target.getFunctionSpace().getTypeCode()==Points) {          if (target.getFunctionSpace().getTypeCode()==Points) {
496             Finley_Assemble_CopyElementData(mesh->Points,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Points,&(target.getDataC()),&(in.getDataC()));
497          } else {          } else {
498             Finley_ErrorCode=TYPE_ERROR;             throw FinleyAdapterException("Error - No interpolation with data on points possible.");
            sprintf(Finley_ErrorMsg,"No interpolation with data on points possible.");  
499             break;             break;
500          }          }
501          break;          break;
# Line 515  void MeshAdapter::interpolateOnDomain(Da Line 504  void MeshAdapter::interpolateOnDomain(Da
504          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {
505             Finley_Assemble_CopyElementData(mesh->ContactElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->ContactElements,&(target.getDataC()),&(in.getDataC()));
506          } else {          } else {
507             Finley_ErrorCode=TYPE_ERROR;             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");
            sprintf(Finley_ErrorMsg,"No interpolation with data on contact elements possible.");  
508             break;             break;
509          }          }
510          break;          break;
# Line 541  void MeshAdapter::interpolateOnDomain(Da Line 529  void MeshAdapter::interpolateOnDomain(Da
529                Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));                Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));
530               break;               break;
531             default:             default:
532               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
533               sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",target.getFunctionSpace().getTypeCode());               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
534                 throw FinleyAdapterException(temp.str());
535               break;               break;
536          }          }
537          break;          break;
538       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
539         switch(target.getFunctionSpace().getTypeCode()) {         switch(target.getFunctionSpace().getTypeCode()) {
540            case(ReducedDegreesOfFreedom):            case(ReducedDegreesOfFreedom):
           case(Nodes):  
541               Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));               Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));
542               break;               break;
543            case(Elements):            case(Elements):
# Line 565  void MeshAdapter::interpolateOnDomain(Da Line 553  void MeshAdapter::interpolateOnDomain(Da
553            case(ContactElementsOne):            case(ContactElementsOne):
554               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));
555               break;               break;
556              case(Nodes):
557                 throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");
558                 break;
559            case(DegreesOfFreedom):            case(DegreesOfFreedom):
560               Finley_ErrorCode=TYPE_ERROR;               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");
              sprintf(Finley_ErrorMsg,"Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");  
561               break;               break;
562            default:            default:
563               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
564               sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",target.getFunctionSpace().getTypeCode());               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
565                 throw FinleyAdapterException(temp.str());
566               break;               break;
567         }         }
568         break;         break;
569       default:       default:
570          Finley_ErrorCode=TYPE_ERROR;          stringstream temp;
571          sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",in.getFunctionSpace().getTypeCode());          temp << "Error - Interpolation On Domain: Finley does not know anything about function space type %d" << in.getFunctionSpace().getTypeCode();
572            throw FinleyAdapterException(temp.str());
573          break;          break;
574    }    }
575    checkFinleyError();    checkFinleyError();
# Line 586  void MeshAdapter::interpolateOnDomain(Da Line 578  void MeshAdapter::interpolateOnDomain(Da
578  //  //
579  // copies the locations of sample points into x:  // copies the locations of sample points into x:
580  //  //
581  void MeshAdapter::setToX(Data& arg) const  void MeshAdapter::setToX(escript::Data& arg) const
582  {  {
583    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());
584    if (argDomain!=*this)    if (argDomain!=*this)
# Line 596  void MeshAdapter::setToX(Data& arg) cons Line 588  void MeshAdapter::setToX(Data& arg) cons
588    if (arg.getFunctionSpace().getTypeCode()==Nodes) {    if (arg.getFunctionSpace().getTypeCode()==Nodes) {
589       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(arg.getDataC()));       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(arg.getDataC()));
590    } else {    } else {
591       Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);       escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);
592       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(tmp_data.getDataC()));       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(tmp_data.getDataC()));
593       // this is then interpolated onto arg:       // this is then interpolated onto arg:
594       interpolateOnDomain(arg,tmp_data);       interpolateOnDomain(arg,tmp_data);
595    }    }
596    checkFinleyError();    checkFinleyError();
597  }  }
598    
599  //  //
600  // return the normal vectors at the location of data points as a Data object:  // return the normal vectors at the location of data points as a Data object:
601  //  //
602  void MeshAdapter::setToNormal(Data& normal) const  void MeshAdapter::setToNormal(escript::Data& normal) const
603  {  {
604    const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());    const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());
605    if (normalDomain!=*this)    if (normalDomain!=*this)
# Line 614  void MeshAdapter::setToNormal(Data& norm Line 607  void MeshAdapter::setToNormal(Data& norm
607    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
608    switch(normal.getFunctionSpace().getTypeCode()) {    switch(normal.getFunctionSpace().getTypeCode()) {
609      case(Nodes):      case(Nodes):
610        Finley_ErrorCode=TYPE_ERROR;        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");
       sprintf(Finley_ErrorMsg,"Finley does not support surface normal vectors for nodes");  
611        break;        break;
612      case(Elements):      case(Elements):
613        Finley_ErrorCode=TYPE_ERROR;        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");
       sprintf(Finley_ErrorMsg,"Finley does not support surface normal vectors for elements");  
614        break;        break;
615      case (FaceElements):      case (FaceElements):
616        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&(normal.getDataC()));
617        break;        break;
618      case(Points):      case(Points):
619        Finley_ErrorCode=TYPE_ERROR;        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for point elements");
       sprintf(Finley_ErrorMsg,"Finley does not support surface normal vectors for point elements");  
620        break;        break;
621      case (ContactElementsOne):      case (ContactElementsOne):
622      case (ContactElementsZero):      case (ContactElementsZero):
623        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&(normal.getDataC()));
624        break;        break;
625      case(DegreesOfFreedom):      case(DegreesOfFreedom):
626        Finley_ErrorCode=TYPE_ERROR;        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for degrees of freedom.");
       sprintf(Finley_ErrorMsg,"Finley does not support surface normal vectors for degrees of freedom.");  
627        break;        break;
628      case(ReducedDegreesOfFreedom):      case(ReducedDegreesOfFreedom):
629        Finley_ErrorCode=TYPE_ERROR;        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced degrees of freedom.");
       sprintf(Finley_ErrorMsg,"Finley does not support surface normal vectors for reduced degrees of freedom.");  
630        break;        break;
631      default:      default:
632        Finley_ErrorCode=TYPE_ERROR;        stringstream temp;
633        sprintf(Finley_ErrorMsg,"Normal Vectors: Finley does not know anything about function space type %d",normal.getFunctionSpace().getTypeCode());        temp << "Error - Normal Vectors: Finley does not know anything about function space type " << normal.getFunctionSpace().getTypeCode();
634          throw FinleyAdapterException(temp.str());
635        break;        break;
636    }    }
637    checkFinleyError();    checkFinleyError();
638  }  }
639    
640  //  //
641  // interpolates data to other domain:  // interpolates data to other domain:
642  //  //
643  void MeshAdapter::interpolateACross(Data& target,const Data& source) const  void MeshAdapter::interpolateACross(escript::Data& target,const escript::Data& source) const
644  {  {
645    const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());    const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());
646    if (targetDomain!=*this)    if (targetDomain!=*this)
647       throw FinleyAdapterException("Error - Illegal domain of interpolation target");       throw FinleyAdapterException("Error - Illegal domain of interpolation target");
648    
649    Finley_ErrorCode=SYSTEM_ERROR;    throw FinleyAdapterException("Error - Finley does not allow interpolation across domains yet.");
   sprintf(Finley_ErrorMsg,"Finley does not allow interpolation across domains yet.");  
   checkFinleyError();  
650  }  }
651    
652  //  //
653  // calculates the integral of a function defined of arg:  // calculates the integral of a function defined of arg:
654  //  //
655  void MeshAdapter::setToIntegrals(std::vector<double>& integrals,const Data& arg) const  void MeshAdapter::setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const
656  {  {
657    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());
658    if (argDomain!=*this)    if (argDomain!=*this)
# Line 672  void MeshAdapter::setToIntegrals(std::ve Line 661  void MeshAdapter::setToIntegrals(std::ve
661    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
662    switch(arg.getFunctionSpace().getTypeCode()) {    switch(arg.getFunctionSpace().getTypeCode()) {
663       case(Nodes):       case(Nodes):
664          Finley_ErrorCode=TYPE_ERROR;          throw FinleyAdapterException("Error - Integral of data on nodes is not supported.");
         sprintf(Finley_ErrorMsg,"Integral of data on nodes is not supported.");  
665          break;          break;
666       case(Elements):       case(Elements):
667          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&(arg.getDataC()),&integrals[0]);
# Line 682  void MeshAdapter::setToIntegrals(std::ve Line 670  void MeshAdapter::setToIntegrals(std::ve
670          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&(arg.getDataC()),&integrals[0]);
671          break;          break;
672       case(Points):       case(Points):
673          Finley_ErrorCode=TYPE_ERROR;          throw FinleyAdapterException("Error - Integral of data on points is not supported.");
         sprintf(Finley_ErrorMsg,"Integral of data on points is not supported.");  
674          break;          break;
675       case(ContactElementsZero):       case(ContactElementsZero):
676          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);
# Line 692  void MeshAdapter::setToIntegrals(std::ve Line 679  void MeshAdapter::setToIntegrals(std::ve
679          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);
680          break;          break;
681       case(DegreesOfFreedom):       case(DegreesOfFreedom):
682          Finley_ErrorCode=TYPE_ERROR;          throw FinleyAdapterException("Error - Integral of data on degrees of freedom is not supported.");
         sprintf(Finley_ErrorMsg,"Integral of data on degrees of freedom is not supported.");  
683          break;          break;
684       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
685          Finley_ErrorCode=TYPE_ERROR;          throw FinleyAdapterException("Error - Integral of data on reduced degrees of freedom is not supported.");
         sprintf(Finley_ErrorMsg,"Integral of data on reduced degrees of freedom is not supported.");  
686          break;          break;
687       default:       default:
688          Finley_ErrorCode=TYPE_ERROR;          stringstream temp;
689          sprintf(Finley_ErrorMsg,"Integrals: Finley does not know anything about function space type %d",arg.getFunctionSpace().getTypeCode());          temp << "Error - Integrals: Finley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();
690            throw FinleyAdapterException(temp.str());
691          break;          break;
692    }    }
693    checkFinleyError();    checkFinleyError();
694  }  }
695    
696  //  //
697  // calculates the gradient of arg:  // calculates the gradient of arg:
698  //  //
699  void MeshAdapter::setToGradient(Data& grad,const Data& arg) const  void MeshAdapter::setToGradient(escript::Data& grad,const escript::Data& arg) const
700  {  {
701    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());
702    if (argDomain!=*this)    if (argDomain!=*this)
# Line 721  void MeshAdapter::setToGradient(Data& gr Line 708  void MeshAdapter::setToGradient(Data& gr
708    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
709    switch(grad.getFunctionSpace().getTypeCode()) {    switch(grad.getFunctionSpace().getTypeCode()) {
710         case(Nodes):         case(Nodes):
711            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");
           sprintf(Finley_ErrorMsg,"Gradient at nodes is not supported.");  
712            break;            break;
713         case(Elements):         case(Elements):
714            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&(grad.getDataC()),&(arg.getDataC()));
# Line 731  void MeshAdapter::setToGradient(Data& gr Line 717  void MeshAdapter::setToGradient(Data& gr
717            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&(grad.getDataC()),&(arg.getDataC()));
718            break;            break;
719         case(Points):         case(Points):
720            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Gradient at points is not supported.");
           sprintf(Finley_ErrorMsg,"Gradient at points is not supported.");  
721            break;            break;
722         case(ContactElementsZero):         case(ContactElementsZero):
723            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));
# Line 741  void MeshAdapter::setToGradient(Data& gr Line 726  void MeshAdapter::setToGradient(Data& gr
726            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));
727            break;            break;
728         case(DegreesOfFreedom):         case(DegreesOfFreedom):
729            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");
           sprintf(Finley_ErrorMsg,"Gradient at degrees of freedom is not supported.");  
730            break;            break;
731         case(ReducedDegreesOfFreedom):         case(ReducedDegreesOfFreedom):
732            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Gradient at reduced degrees of freedom is not supported.");
           sprintf(Finley_ErrorMsg,"Gradient at reduced degrees of freedom is not supported.");  
733            break;            break;
734         default:         default:
735            Finley_ErrorCode=TYPE_ERROR;            stringstream temp;
736            sprintf(Finley_ErrorMsg,"Gradient: Finley does not know anything about function space type %d",arg.getFunctionSpace().getTypeCode());            temp << "Error - Gradient: Finley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();
737              throw FinleyAdapterException(temp.str());
738            break;            break;
739    }    }
740    checkFinleyError();    checkFinleyError();
741  }  }
742    
743  //  //
744  // returns the size of elements:  // returns the size of elements:
745  //  //
746  void MeshAdapter::setToSize(Data& size) const  void MeshAdapter::setToSize(escript::Data& size) const
747  {  {
748    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
749    escriptDataC tmp=size.getDataC();    escriptDataC tmp=size.getDataC();
750    switch(size.getFunctionSpace().getTypeCode()) {    switch(size.getFunctionSpace().getTypeCode()) {
751         case(Nodes):         case(Nodes):
752            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Size of nodes is not supported.");
           sprintf(Finley_ErrorMsg,"Size of nodes is not supported.");  
753            break;            break;
754         case(Elements):         case(Elements):
755            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
# Line 774  void MeshAdapter::setToSize(Data& size) Line 758  void MeshAdapter::setToSize(Data& size)
758            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
759            break;            break;
760         case(Points):         case(Points):
761            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Size of point elements is not supported.");
           sprintf(Finley_ErrorMsg,"Size of point elements is not supported.");  
762            break;            break;
763         case(ContactElementsZero):         case(ContactElementsZero):
764         case(ContactElementsOne):         case(ContactElementsOne):
765            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
766            break;            break;
767         case(DegreesOfFreedom):         case(DegreesOfFreedom):
768            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");
           sprintf(Finley_ErrorMsg,"Size of degrees of freedom is not supported.");  
769            break;            break;
770         case(ReducedDegreesOfFreedom):         case(ReducedDegreesOfFreedom):
771            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Size of reduced degrees of freedom is not supported.");
           sprintf(Finley_ErrorMsg,"Size of reduced degrees of freedom is not supported.");  
772            break;            break;
773         default:         default:
774            Finley_ErrorCode=TYPE_ERROR;            stringstream temp;
775            sprintf(Finley_ErrorMsg,"Element size: Finley does not know anything about function space type %d",size.getFunctionSpace().getTypeCode());            temp << "Error - Element size: Finley does not know anything about function space type " << size.getFunctionSpace().getTypeCode();
776              throw FinleyAdapterException(temp.str());
777            break;            break;
778    }    }
779    checkFinleyError();    checkFinleyError();
780  }  }
781    
782  // sets the location of nodes:  // sets the location of nodes:
783  void MeshAdapter::setNewX(const Data& new_x)  void MeshAdapter::setNewX(const escript::Data& new_x)
784  {  {
785    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
786    const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(new_x.getFunctionSpace().getDomain());    const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(new_x.getFunctionSpace().getDomain());
787    if (newDomain!=*this)    if (newDomain!=*this)
788       throw FinleyAdapterException("Error - Illegal domain of new point locations");       throw FinleyAdapterException("Error - Illegal domain of new point locations");
789    Finley_NodeFile_setCoordinates(mesh->Nodes,&(new_x.getDataC()));    Finley_Mesh_setCoordinates(mesh,&(new_x.getDataC()));
790    checkFinleyError();    checkFinleyError();
791  }  }
792    
793  // saves a data array in openDX format:  // saves a data array in openDX format:
794  void MeshAdapter::saveDX(const std::string& filename,const Data& arg) const  void MeshAdapter::saveDX(const std::string& filename,const boost::python::dict& arg) const
795  {  {
796    Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));      int MAX_namelength=256;
797    checkFinleyError();      const int num_data=boost::python::extract<int>(arg.attr("__len__")());
798        char names[num_data][MAX_namelength];
799        char* c_names[num_data];
800        escriptDataC data[num_data];
801        escriptDataC* ptr_data[num_data];
802    
803        boost::python::list keys=arg.keys();
804        for (int i=0;i<num_data;++i) {
805             escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
806             if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
807                 throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
808             data[i]=d.getDataC();
809             ptr_data[i]=&(data[i]);
810             std::string n=boost::python::extract<std::string>(keys[i]);
811             c_names[i]=&(names[i][0]);
812             if (n.length()>MAX_namelength-1) {
813                strncpy(c_names[i],n.c_str(),MAX_namelength-1);
814                c_names[i][MAX_namelength-1]='\0';
815             } else {
816                strcpy(c_names[i],n.c_str());
817             }
818        }
819        Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);
820        checkFinleyError();
821        return;
822  }  }
823    
824  // saves a data array in openVTK format:  // saves a data array in openVTK format:
825  void MeshAdapter::saveVTK(const std::string& filename,const Data& arg) const  void MeshAdapter::saveVTK(const std::string& filename,const boost::python::dict& arg) const
826  {  {
827    Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));      int MAX_namelength=256;
828    checkFinleyError();      const int num_data=boost::python::extract<int>(arg.attr("__len__")());
829        char names[num_data][MAX_namelength];
830        char* c_names[num_data];
831        escriptDataC data[num_data];
832        escriptDataC* ptr_data[num_data];
833    
834        boost::python::list keys=arg.keys();
835        for (int i=0;i<num_data;++i) {
836             escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
837             if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
838                 throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
839             data[i]=d.getDataC();
840             ptr_data[i]=&(data[i]);
841             std::string n=boost::python::extract<std::string>(keys[i]);
842             c_names[i]=&(names[i][0]);
843             if (n.length()>MAX_namelength-1) {
844                strncpy(c_names[i],n.c_str(),MAX_namelength-1);
845                c_names[i][MAX_namelength-1]='\0';
846             } else {
847                strcpy(c_names[i],n.c_str());
848             }
849        }
850        Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);
851        checkFinleyError();
852        return;
853  }  }
854                                                                                                                                                                            
855                                                                                                                                                                            
856  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
857  SystemMatrixAdapter MeshAdapter::newSystemMatrix(  SystemMatrixAdapter MeshAdapter::newSystemMatrix(
858                        const int row_blocksize,                        const int row_blocksize,
# Line 852  SystemMatrixAdapter MeshAdapter::newSyst Line 887  SystemMatrixAdapter MeshAdapter::newSyst
887      }      }
888      // generate matrix:      // generate matrix:
889            
890      Finley_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);
     checkFinleyError();  
     Finley_SystemMatrix* fsystemMatrix=Finley_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);  
891      checkFinleyError();      checkFinleyError();
892        Paso_SystemMatrix* fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);
893        checkPasoError();
894        Paso_SystemMatrixPattern_dealloc(fsystemMatrixPattern);
895      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
896  }  }
897    
898  //  //
899  // vtkObject MeshAdapter::createVtkObject() const  // vtkObject MeshAdapter::createVtkObject() const
900  // TODO:  // TODO:
901  //  //
902    
903  //  //
904  // returns true if data at the atom_type is considered as being cell centered:  // returns true if data at the atom_type is considered as being cell centered:
905  bool MeshAdapter::isCellOriented(int functionSpaceCode) const  bool MeshAdapter::isCellOriented(int functionSpaceCode) const
# Line 880  bool MeshAdapter::isCellOriented(int fun Line 918  bool MeshAdapter::isCellOriented(int fun
918            return true;            return true;
919            break;            break;
920         default:         default:
921            Finley_ErrorCode=TYPE_ERROR;            stringstream temp;
922            sprintf(Finley_ErrorMsg,"Cell: Finley does not know anything about function space type %d",functionSpaceCode);            temp << "Error - Cell: Finley does not know anything about function space type " << functionSpaceCode;
923              throw FinleyAdapterException(temp.str());
924            break;            break;
925    }    }
926    checkFinleyError();    checkFinleyError();
927    return false;    return false;
928  }  }
929    
930  bool MeshAdapter::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const  bool MeshAdapter::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const
931  {  {
932    switch(functionSpaceType_source) {    switch(functionSpaceType_source) {
# Line 902  bool MeshAdapter::probeInterpolationOnDo Line 942  bool MeshAdapter::probeInterpolationOnDo
942             case(ContactElementsOne):             case(ContactElementsOne):
943                 return true;                 return true;
944             default:             default:
945                 Finley_ErrorCode=TYPE_ERROR;                 stringstream temp;
946                 sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",functionSpaceType_target);                 temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
947                   throw FinleyAdapterException(temp.str());
948          }          }
949          break;          break;
950       case(Elements):       case(Elements):
# Line 943  bool MeshAdapter::probeInterpolationOnDo Line 984  bool MeshAdapter::probeInterpolationOnDo
984             case(ContactElementsOne):             case(ContactElementsOne):
985                return true;                return true;
986             default:             default:
987               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
988               sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",functionSpaceType_target);               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
989                 throw FinleyAdapterException(temp.str());
990          }          }
991          break;          break;
992       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
993         switch(functionSpaceType_target) {         switch(functionSpaceType_target) {
994            case(ReducedDegreesOfFreedom):            case(ReducedDegreesOfFreedom):
           case(Nodes):  
995            case(Elements):            case(Elements):
996            case(FaceElements):            case(FaceElements):
997            case(Points):            case(Points):
998            case(ContactElementsZero):            case(ContactElementsZero):
999            case(ContactElementsOne):            case(ContactElementsOne):
1000                return true;                return true;
1001              case(Nodes):
1002            case(DegreesOfFreedom):            case(DegreesOfFreedom):
1003               return false;               return false;
1004            default:            default:
1005               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
1006               sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",functionSpaceType_target);               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1007                 throw FinleyAdapterException(temp.str());
1008         }         }
1009         break;         break;
1010       default:       default:
1011          Finley_ErrorCode=TYPE_ERROR;          stringstream temp;
1012          sprintf(Finley_ErrorMsg,"Interpolation On Domain: Finley does not know anything about function space type %d",functionSpaceType_source);          temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_source;
1013            throw FinleyAdapterException(temp.str());
1014          break;          break;
1015    }    }
1016    checkFinleyError();    checkFinleyError();
1017    return false;    return false;
1018  }  }
1019    
1020  bool MeshAdapter::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const  bool MeshAdapter::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
1021  {  {
1022      return false;      return false;
1023  }  }
1024    
1025  bool MeshAdapter::operator==(const MeshAdapter& other) const  bool MeshAdapter::operator==(const AbstractDomain& other) const
1026  {  {
1027    return (m_finleyMesh==other.m_finleyMesh);    const MeshAdapter* temp=dynamic_cast<const MeshAdapter*>(&other);
1028      if (temp!=0) {
1029        return (m_finleyMesh==temp->m_finleyMesh);
1030      } else {
1031        return false;
1032      }
1033  }  }
1034    
1035  bool MeshAdapter::operator!=(const MeshAdapter& other) const  bool MeshAdapter::operator!=(const AbstractDomain& other) const
1036  {  {
1037    return !operator==(other);    return !(operator==(other));
1038  }  }
1039    
1040  int MeshAdapter::getSystemMatrixTypeId(const int solver, const bool symmetry) const  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int package, const bool symmetry) const
1041  {  {
1042     int out=Finley_SystemMatrix_getSystemMatrixTypeId(solver,symmetry?1:0);     int out=Paso_SystemMatrix_getSystemMatrixTypeId(SystemMatrixAdapter::mapOptionToPaso(solver),SystemMatrixAdapter::mapOptionToPaso(package),symmetry?1:0);
1043     checkFinleyError();     checkPasoError();
1044     return out;     return out;
1045  }  }
1046  Data MeshAdapter::getX() const  
1047    escript::Data MeshAdapter::getX() const
1048  {  {
1049    return continuousFunction(asAbstractContinuousDomain()).getX();    return continuousFunction(asAbstractContinuousDomain()).getX();
1050  }  }
1051  Data MeshAdapter::getNormal() const  
1052    escript::Data MeshAdapter::getNormal() const
1053  {  {
1054    return functionOnBoundary(asAbstractContinuousDomain()).getNormal();    return functionOnBoundary(asAbstractContinuousDomain()).getNormal();
1055  }  }
1056  Data MeshAdapter::getSize() const  
1057    escript::Data MeshAdapter::getSize() const
1058  {  {
1059    return function(asAbstractContinuousDomain()).getSize();    return function(asAbstractContinuousDomain()).getSize();
1060  }  }

Legend:
Removed from v.110  
changed lines
  Added in v.532

  ViewVC Help
Powered by ViewVC 1.1.26