/[escript]/branches/trilinos_from_5897/dudley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /branches/trilinos_from_5897/dudley/src/CPPAdapter/MeshAdapter.cpp

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

revision 6008 by caltinay, Mon Feb 22 06:59:27 2016 UTC revision 6009 by caltinay, Wed Mar 2 04:13:26 2016 UTC
# Line 14  Line 14 
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
 #define ESNEEDPYTHON  
 #include "esysUtils/first.h"  
   
17  #include "MeshAdapter.h"  #include "MeshAdapter.h"
18    
19  #include <escript/Data.h>  #include <escript/Data.h>
20  #include <escript/DataFactory.h>  #include <escript/DataFactory.h>
21  #include <escript/Random.h>  #include <escript/Random.h>
# Line 77  MeshAdapter::~MeshAdapter() Line 75  MeshAdapter::~MeshAdapter()
75     }     }
76  }  }
77    
78    escript::JMPI MeshAdapter::getMPI() const
79    {
80        return m_dudleyMesh.get()->MPIInfo;
81    }
82    
83  int MeshAdapter::getMPISize() const  int MeshAdapter::getMPISize() const
84  {  {
85     return m_dudleyMesh.get()->MPIInfo->size;     return m_dudleyMesh.get()->MPIInfo->size;
86  }  }
87    
88  int MeshAdapter::getMPIRank() const  int MeshAdapter::getMPIRank() const
89  {  {
90     return m_dudleyMesh.get()->MPIInfo->rank;     return m_dudleyMesh.get()->MPIInfo->rank;
91  }  }
92    
93  void MeshAdapter::MPIBarrier() const  void MeshAdapter::MPIBarrier() const
94  {  {
95  #ifdef ESYS_MPI  #ifdef ESYS_MPI
96     MPI_Barrier(m_dudleyMesh.get()->MPIInfo->comm);     MPI_Barrier(m_dudleyMesh.get()->MPIInfo->comm);
97  #endif  #endif
    return;  
98  }  }
99    
100  bool MeshAdapter::onMasterProcessor() const  bool MeshAdapter::onMasterProcessor() const
101  {  {
102     return m_dudleyMesh.get()->MPIInfo->rank == 0;     return m_dudleyMesh.get()->MPIInfo->rank == 0;
# Line 102  MPI_Comm MeshAdapter::getMPIComm() const Line 107  MPI_Comm MeshAdapter::getMPIComm() const
107      return m_dudleyMesh->MPIInfo->comm;      return m_dudleyMesh->MPIInfo->comm;
108  }  }
109    
   
110  Dudley_Mesh* MeshAdapter::getDudley_Mesh() const  Dudley_Mesh* MeshAdapter::getDudley_Mesh() const
111  {  {
112     return m_dudleyMesh.get();     return m_dudleyMesh.get();
# Line 113  void MeshAdapter::write(const string& fi Line 117  void MeshAdapter::write(const string& fi
117     char *fName = (fileName.size()+1>0) ? new char[fileName.size()+1] : (char*)NULL;     char *fName = (fileName.size()+1>0) ? new char[fileName.size()+1] : (char*)NULL;
118     strcpy(fName,fileName.c_str());     strcpy(fName,fileName.c_str());
119     Dudley_Mesh_write(m_dudleyMesh.get(),fName);     Dudley_Mesh_write(m_dudleyMesh.get(),fName);
    checkDudleyError();  
120     delete[] fName;     delete[] fName;
121  }  }
122    
# Line 149  void MeshAdapter::dump(const string& fil Line 152  void MeshAdapter::dump(const string& fil
152     if (mpi_rank>0) MPI_Recv(&num_Tags, 0, MPI_INT, mpi_rank-1, 81800, mesh->MPIInfo->comm, &status);     if (mpi_rank>0) MPI_Recv(&num_Tags, 0, MPI_INT, mpi_rank-1, 81800, mesh->MPIInfo->comm, &status);
153  #endif  #endif
154    
155     string newFileName(esysUtils::appendRankToFileName(     string newFileName(mesh->MPIInfo->appendRankToFileName(fileName));
                                             fileName, mpi_size, mpi_rank));  
156    
157     /* Figure out how much storage is required for tags */     /* Figure out how much storage is required for tags */
158     tag_map = mesh->TagMap;     tag_map = mesh->TagMap;
# Line 475  void MeshAdapter::dump(const string& fil Line 477  void MeshAdapter::dump(const string& fil
477     // NetCDF file is closed by destructor of NcFile object     // NetCDF file is closed by destructor of NcFile object
478    
479  #else  #else
480     Dudley_setError(IO_ERROR, "MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");     throw DudleyException("MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");
481  #endif  /* USE_NETCDF */  #endif  /* USE_NETCDF */
    checkDudleyError();  
482  }  }
483    
484  string MeshAdapter::getDescription() const  string MeshAdapter::getDescription() const
# Line 554  int MeshAdapter::getReducedFunctionOnBou Line 555  int MeshAdapter::getReducedFunctionOnBou
555    
556  int MeshAdapter::getFunctionOnContactZeroCode() const  int MeshAdapter::getFunctionOnContactZeroCode() const
557  {  {
558     throw DudleyAdapterException("Dudley does not support contact elements.");     throw DudleyException("Dudley does not support contact elements.");
559  }  }
560    
561  int MeshAdapter::getReducedFunctionOnContactZeroCode() const  int MeshAdapter::getReducedFunctionOnContactZeroCode() const
562  {  {
563     throw DudleyAdapterException("Dudley does not support contact elements.");     throw DudleyException("Dudley does not support contact elements.");
564  }  }
565    
566  int MeshAdapter::getFunctionOnContactOneCode() const  int MeshAdapter::getFunctionOnContactOneCode() const
567  {  {
568     throw DudleyAdapterException("Dudley does not support contact elements.");     throw DudleyException("Dudley does not support contact elements.");
569  }  }
570    
571  int MeshAdapter::getReducedFunctionOnContactOneCode() const  int MeshAdapter::getReducedFunctionOnContactOneCode() const
572  {  {
573     throw DudleyAdapterException("Dudley does not support contact elements.");     throw DudleyException("Dudley does not support contact elements.");
574  }  }
575    
576  int MeshAdapter::getSolutionCode() const  int MeshAdapter::getSolutionCode() const
# Line 594  int MeshAdapter::getDim() const Line 595  int MeshAdapter::getDim() const
595  {  {
596     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
597     int numDim=Dudley_Mesh_getDim(mesh);     int numDim=Dudley_Mesh_getDim(mesh);
    checkDudleyError();  
598     return numDim;     return numDim;
599  }  }
600    
# Line 669  pair<int,int> MeshAdapter::getDataShape( Line 669  pair<int,int> MeshAdapter::getDataShape(
669     default:     default:
670        stringstream temp;        stringstream temp;
671        temp << "Error - Invalid function space type: " << functionSpaceCode << " for domain: " << getDescription();        temp << "Error - Invalid function space type: " << functionSpaceCode << " for domain: " << getDescription();
672        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
673        break;        break;
674     }     }
675     return pair<int,int>(numDataPointsPerSample,numSamples);     return pair<int,int>(numDataPointsPerSample,numSamples);
# Line 689  void MeshAdapter::addPDEToSystem(Abstrac Line 689  void MeshAdapter::addPDEToSystem(Abstrac
689                                   const escript::Data& y_dirac) const                                   const escript::Data& y_dirac) const
690  {  {
691      if (!d_contact.isEmpty() || !y_contact.isEmpty())      if (!d_contact.isEmpty() || !y_contact.isEmpty())
692          throw DudleyAdapterException("Dudley does not support contact elements");          throw DudleyException("Dudley does not support contact elements");
693    
694      paso::SystemMatrix* smat = dynamic_cast<paso::SystemMatrix*>(&mat);      paso::SystemMatrix* smat = dynamic_cast<paso::SystemMatrix*>(&mat);
695      if (smat) {      if (smat) {
696          paso::SystemMatrix_ptr S(smat->shared_from_this());          paso::SystemMatrix_ptr S(smat->shared_from_this());
697          Dudley_Mesh* mesh = m_dudleyMesh.get();          Dudley_Mesh* mesh = m_dudleyMesh.get();
698    
699          Dudley_Assemble_PDE(mesh->Nodes, mesh->Elements, S, &rhs, &A, &B, &C, &D, &X, &Y);          Assemble_PDE(mesh->Nodes, mesh->Elements, S, rhs, A, B, C, D, X, Y);
         checkDudleyError();  
700    
701          Dudley_Assemble_PDE(mesh->Nodes, mesh->FaceElements, S, &rhs, 0, 0, 0, &d, 0, &y);          Assemble_PDE(mesh->Nodes, mesh->FaceElements, S, rhs, escript::Data(),
702          checkDudleyError();                       escript::Data(), escript::Data(), d, escript::Data(), y);
703    
704          Dudley_Assemble_PDE(mesh->Nodes,mesh->Points, S, &rhs, 0, 0, 0, &d_dirac, 0, &y_dirac);          Assemble_PDE(mesh->Nodes, mesh->Points, S, rhs, escript::Data(),
705          checkDudleyError();                       escript::Data(), escript::Data(), d_dirac,
706                         escript::Data(), y_dirac);
707          return;          return;
708      }      }
709      throw DudleyAdapterException("Dudley only accepts Paso system matrices");      throw DudleyException("Dudley only accepts Paso system matrices");
710  }  }
711    
712  void  MeshAdapter::addPDEToLumpedSystem(escript::Data& mat,  void  MeshAdapter::addPDEToLumpedSystem(escript::Data& mat,
# Line 717  void  MeshAdapter::addPDEToLumpedSystem( Line 717  void  MeshAdapter::addPDEToLumpedSystem(
717  {  {
718     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
719    
720     Dudley_Assemble_LumpedSystem(mesh->Nodes,mesh->Elements, &mat, &D, useHRZ);     Assemble_LumpedSystem(mesh->Nodes,mesh->Elements, mat, D, useHRZ);
721     checkDudleyError();     Assemble_LumpedSystem(mesh->Nodes,mesh->FaceElements, mat, d, useHRZ);
722         Assemble_LumpedSystem(mesh->Nodes,mesh->FaceElements, mat, d_dirac, useHRZ);
    Dudley_Assemble_LumpedSystem(mesh->Nodes,mesh->FaceElements, &mat, &d, useHRZ);  
    checkDudleyError();  
   
    Dudley_Assemble_LumpedSystem(mesh->Nodes,mesh->FaceElements, &mat, &d_dirac, useHRZ);  
    checkDudleyError();  
   
723  }  }
724    
725    
726  //  //
727  // adds linear PDE of second order into the right hand side only  // adds linear PDE of second order into the right hand side only
728  //  //
729  void MeshAdapter::addPDEToRHS( escript::Data& rhs, const escript::Data& X,const  escript::Data& Y, const escript::Data& y, const escript::Data& y_contact, const escript::Data& y_dirac) const  void MeshAdapter::addPDEToRHS(escript::Data& rhs, const escript::Data& X,const  escript::Data& Y, const escript::Data& y, const escript::Data& y_contact, const escript::Data& y_dirac) const
730  {  {
731     if (!y_contact.isEmpty())     if (!y_contact.isEmpty())
732     {     {
733          throw DudleyAdapterException("Dudley does not support y_contact");          throw DudleyException("Dudley does not support y_contact");
734     }     }
735     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
736    
737     Dudley_Assemble_PDE(mesh->Nodes,mesh->Elements, escript::ASM_ptr(), &rhs,     Assemble_PDE(mesh->Nodes, mesh->Elements, escript::ASM_ptr(), rhs,
738                         NULL, NULL, NULL, NULL, &X, &Y);                  escript::Data(), escript::Data(), escript::Data(),
739     checkDudleyError();                  escript::Data(), X, Y);
740    
741     Dudley_Assemble_PDE(mesh->Nodes,mesh->FaceElements, escript::ASM_ptr(),     Assemble_PDE(mesh->Nodes, mesh->FaceElements, escript::ASM_ptr(), rhs,
742                         &rhs, NULL, NULL, NULL, NULL, NULL, &y);                  escript::Data(), escript::Data(), escript::Data(),
743     checkDudleyError();                  escript::Data(), escript::Data(), y);
744    
745     Dudley_Assemble_PDE(mesh->Nodes,mesh->Points, escript::ASM_ptr(), &rhs,     Assemble_PDE(mesh->Nodes, mesh->Points, escript::ASM_ptr(), rhs,
746                         NULL, NULL, NULL, NULL, NULL, &y_dirac);                  escript::Data(), escript::Data(), escript::Data(),
747     checkDudleyError();                  escript::Data(), escript::Data(), y_dirac);
748  }  }
749  //  //
750  // adds PDE of second order into a transport problem  // adds PDE of second order into a transport problem
# Line 765  void MeshAdapter::addPDEToTransportProbl Line 759  void MeshAdapter::addPDEToTransportProbl
759  {  {
760      if (!d_contact.isEmpty())      if (!d_contact.isEmpty())
761      {      {
762          throw DudleyAdapterException("Dudley does not support d_contact");          throw DudleyException("Dudley does not support d_contact");
763      }      }
764      if (!y_contact.isEmpty())      if (!y_contact.isEmpty())
765      {      {
766          throw DudleyAdapterException("Dudley does not support y_contact");          throw DudleyException("Dudley does not support y_contact");
767      }        }  
768      paso::TransportProblem* ptp = dynamic_cast<paso::TransportProblem*>(&tp);      paso::TransportProblem* ptp = dynamic_cast<paso::TransportProblem*>(&tp);
769      if (!ptp)      if (!ptp)
770      {      {
771          throw DudleyAdapterException("Dudley only accepts Paso transport problems");          throw DudleyException("Dudley only accepts Paso transport problems");
772      }      }
773      DataTypes::ShapeType shape;      DataTypes::ShapeType shape;
774      source.expand();      source.expand();
775    
776     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
777    
778     Dudley_Assemble_PDE(mesh->Nodes, mesh->Elements, ptp->borrowMassMatrix(),     Assemble_PDE(mesh->Nodes, mesh->Elements, ptp->borrowMassMatrix(), source,
779                         &source, 0, 0, 0, &M, 0, 0);                  escript::Data(), escript::Data(), escript::Data(), M,
780     checkDudleyError();                  escript::Data(), escript::Data());
781    
782     Dudley_Assemble_PDE(mesh->Nodes, mesh->Elements, ptp->borrowTransportMatrix(),     Assemble_PDE(mesh->Nodes, mesh->Elements, ptp->borrowTransportMatrix(),
783                         &source, &A, &B, &C, &D, &X, &Y);                  source, A, B, C, D, X, Y);
784     checkDudleyError();  
785       Assemble_PDE(mesh->Nodes, mesh->FaceElements, ptp->borrowTransportMatrix(),
786     Dudley_Assemble_PDE(mesh->Nodes, mesh->FaceElements,                  source, escript::Data(), escript::Data(), escript::Data(), d,
787                         ptp->borrowTransportMatrix(), &source, NULL, NULL, NULL,                  escript::Data(), y);
788                         &d, NULL, &y);  
789     checkDudleyError();     Assemble_PDE(mesh->Nodes, mesh->Points, ptp->borrowTransportMatrix(),
790                    source, escript::Data(), escript::Data(), escript::Data(),
791     Dudley_Assemble_PDE(mesh->Nodes, mesh->Points, ptp->borrowTransportMatrix(),                  d_dirac, escript::Data(), y_dirac);
                        &source, NULL, NULL, NULL, &d_dirac, NULL, &y_dirac);  
    checkDudleyError();  
792  }  }
793    
794  //  //
# Line 807  void MeshAdapter::interpolateOnDomain(es Line 799  void MeshAdapter::interpolateOnDomain(es
799     const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(*(in.getFunctionSpace().getDomain()));     const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(*(in.getFunctionSpace().getDomain()));
800     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(*(target.getFunctionSpace().getDomain()));     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(*(target.getFunctionSpace().getDomain()));
801     if (inDomain!=*this)       if (inDomain!=*this)  
802        throw DudleyAdapterException("Error - Illegal domain of interpolant.");        throw DudleyException("Illegal domain of interpolant.");
803     if (targetDomain!=*this)     if (targetDomain!=*this)
804        throw DudleyAdapterException("Error - Illegal domain of interpolation target.");        throw DudleyException("Illegal domain of interpolation target.");
805    
806     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
807     switch(in.getFunctionSpace().getTypeCode()) {     switch(in.getFunctionSpace().getTypeCode()) {
# Line 819  void MeshAdapter::interpolateOnDomain(es Line 811  void MeshAdapter::interpolateOnDomain(es
811        case(ReducedNodes):        case(ReducedNodes):
812        case(DegreesOfFreedom):        case(DegreesOfFreedom):
813        case(ReducedDegreesOfFreedom):        case(ReducedDegreesOfFreedom):
814        Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&in);        Assemble_CopyNodalData(mesh->Nodes,&target,&in);
815        break;        break;
816        case(Elements):        case(Elements):
817        case(ReducedElements):        case(ReducedElements):
818        Dudley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);        Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);
819        break;        break;
820        case(FaceElements):        case(FaceElements):
821        case(ReducedFaceElements):        case(ReducedFaceElements):
822        Dudley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);        Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);
823        break;        break;
824        case(Points):        case(Points):
825        Dudley_Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);        Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);
826        break;        break;
827        default:        default:
828           stringstream temp;           stringstream temp;
829           temp << "Error - Interpolation on Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();           temp << "Interpolation on Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
830           throw DudleyAdapterException(temp.str());           throw DudleyException(temp.str());
831           break;           break;
832        }        }
833        break;        break;
# Line 845  void MeshAdapter::interpolateOnDomain(es Line 837  void MeshAdapter::interpolateOnDomain(es
837        case(ReducedNodes):        case(ReducedNodes):
838        case(DegreesOfFreedom):        case(DegreesOfFreedom):
839        case(ReducedDegreesOfFreedom):        case(ReducedDegreesOfFreedom):
840        Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&in);        Assemble_CopyNodalData(mesh->Nodes,&target,&in);
841        break;        break;
842        case(Elements):        case(Elements):
843        case(ReducedElements):        case(ReducedElements):
844        Dudley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);        Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);
845        break;        break;
846        case(FaceElements):        case(FaceElements):
847        case(ReducedFaceElements):        case(ReducedFaceElements):
848        Dudley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);        Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);
849        break;        break;
850        case(Points):        case(Points):
851        Dudley_Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);        Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);
852        break;        break;
853        default:        default:
854           stringstream temp;           stringstream temp;
855           temp << "Error - Interpolation on Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();           temp << "Interpolation on Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
856           throw DudleyAdapterException(temp.str());           throw DudleyException(temp.str());
857           break;           break;
858        }        }
859        break;        break;
860     case(Elements):     case(Elements):
861        if (target.getFunctionSpace().getTypeCode()==Elements) {        if (target.getFunctionSpace().getTypeCode()==Elements) {
862           Dudley_Assemble_CopyElementData(mesh->Elements,&target,&in);           Assemble_CopyElementData(mesh->Elements,&target,&in);
863        } else if (target.getFunctionSpace().getTypeCode()==ReducedElements) {        } else if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
864           Dudley_Assemble_AverageElementData(mesh->Elements,&target,&in);           Assemble_AverageElementData(mesh->Elements,&target,&in);
865        } else {        } else {
866           throw DudleyAdapterException("Error - No interpolation with data on elements possible.");           throw DudleyException("No interpolation with data on elements possible.");
867        }        }
868        break;        break;
869     case(ReducedElements):     case(ReducedElements):
870        if (target.getFunctionSpace().getTypeCode()==ReducedElements) {        if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
871           Dudley_Assemble_CopyElementData(mesh->Elements,&target,&in);           Assemble_CopyElementData(mesh->Elements,&target,&in);
872        } else {        } else {
873           throw DudleyAdapterException("Error - No interpolation with data on elements with reduced integration order possible.");           throw DudleyException("No interpolation with data on elements with reduced integration order possible.");
874        }        }
875        break;        break;
876     case(FaceElements):     case(FaceElements):
877        if (target.getFunctionSpace().getTypeCode()==FaceElements) {        if (target.getFunctionSpace().getTypeCode()==FaceElements) {
878           Dudley_Assemble_CopyElementData(mesh->FaceElements,&target,&in);           Assemble_CopyElementData(mesh->FaceElements,&target,&in);
879        } else if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {        } else if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
880           Dudley_Assemble_AverageElementData(mesh->FaceElements,&target,&in);           Assemble_AverageElementData(mesh->FaceElements,&target,&in);
881        } else {        } else {
882           throw DudleyAdapterException("Error - No interpolation with data on face elements possible.");           throw DudleyException("No interpolation with data on face elements possible.");
883        }        }
884        break;        break;
885     case(ReducedFaceElements):     case(ReducedFaceElements):
886        if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {        if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
887           Dudley_Assemble_CopyElementData(mesh->FaceElements,&target,&in);           Assemble_CopyElementData(mesh->FaceElements,&target,&in);
888        } else {        } else {
889           throw DudleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");           throw DudleyException("No interpolation with data on face elements with reduced integration order possible.");
890        }        }
891        break;        break;
892     case(Points):     case(Points):
893        if (target.getFunctionSpace().getTypeCode()==Points) {        if (target.getFunctionSpace().getTypeCode()==Points) {
894           Dudley_Assemble_CopyElementData(mesh->Points,&target,&in);           Assemble_CopyElementData(mesh->Points,&target,&in);
895        } else {        } else {
896           throw DudleyAdapterException("Error - No interpolation with data on points possible.");           throw DudleyException("No interpolation with data on points possible.");
897        }        }
898        break;        break;
899     case(DegreesOfFreedom):           case(DegreesOfFreedom):      
900        switch(target.getFunctionSpace().getTypeCode()) {        switch(target.getFunctionSpace().getTypeCode()) {
901        case(ReducedDegreesOfFreedom):        case(ReducedDegreesOfFreedom):
902        case(DegreesOfFreedom):        case(DegreesOfFreedom):
903        Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&in);        Assemble_CopyNodalData(mesh->Nodes,&target,&in);
904        break;        break;
905        
906        case(Nodes):        case(Nodes):
# Line 916  void MeshAdapter::interpolateOnDomain(es Line 908  void MeshAdapter::interpolateOnDomain(es
908        if (getMPISize()>1) {        if (getMPISize()>1) {
909           escript::Data temp=escript::Data(in);           escript::Data temp=escript::Data(in);
910           temp.expand();           temp.expand();
911           Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&temp);           Assemble_CopyNodalData(mesh->Nodes,&target,&temp);
912        } else {        } else {
913           Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&in);           Assemble_CopyNodalData(mesh->Nodes,&target,&in);
914        }        }
915        break;        break;
916        case(Elements):        case(Elements):
917        case(ReducedElements):        case(ReducedElements):
918        if (getMPISize()>1) {        if (getMPISize()>1) {
919           escript::Data temp=escript::Data( in,  continuousFunction(*this) );           escript::Data temp=escript::Data( in,  continuousFunction(*this) );
920           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&temp,&target);           Assemble_interpolate(mesh->Nodes,mesh->Elements,&temp,&target);
921        } else {        } else {
922           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);           Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);
923        }        }
924        break;        break;
925        case(FaceElements):        case(FaceElements):
926        case(ReducedFaceElements):        case(ReducedFaceElements):
927        if (getMPISize()>1) {        if (getMPISize()>1) {
928           escript::Data temp=escript::Data( in,  continuousFunction(*this) );           escript::Data temp=escript::Data( in,  continuousFunction(*this) );
929           Dudley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&temp,&target);           Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&temp,&target);
930        
931        } else {        } else {
932           Dudley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);           Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);
933        }        }
934        break;        break;
935        case(Points):        case(Points):
# Line 945  void MeshAdapter::interpolateOnDomain(es Line 937  void MeshAdapter::interpolateOnDomain(es
937           //escript::Data temp=escript::Data( in,  continuousFunction(*this) );           //escript::Data temp=escript::Data( in,  continuousFunction(*this) );
938           //escriptDataC _in2 = temp.getDataC();           //escriptDataC _in2 = temp.getDataC();
939        } else {        } else {
940           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);           Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);
941        }        }
942        break;        break;
943        default:        default:
944           stringstream temp;           stringstream temp;
945           temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();           temp << "Interpolation On Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
946           throw DudleyAdapterException(temp.str());           throw DudleyException(temp.str());
947           break;           break;
948        }        }
949        break;        break;
950     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
951        switch(target.getFunctionSpace().getTypeCode()) {        switch(target.getFunctionSpace().getTypeCode()) {
952        case(Nodes):        case(Nodes):
953        throw DudleyAdapterException("Error - Dudley does not support interpolation from reduced degrees of freedom to mesh nodes.");        throw DudleyException("Dudley does not support interpolation from reduced degrees of freedom to mesh nodes.");
954        break;        break;
955        case(ReducedNodes):        case(ReducedNodes):
956        if (getMPISize()>1) {        if (getMPISize()>1) {
957           escript::Data temp=escript::Data(in);           escript::Data temp=escript::Data(in);
958           temp.expand();           temp.expand();
959           Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&temp);           Assemble_CopyNodalData(mesh->Nodes,&target,&temp);
960        } else {        } else {
961           Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&in);           Assemble_CopyNodalData(mesh->Nodes,&target,&in);
962        }        }
963        break;        break;
964        case(DegreesOfFreedom):        case(DegreesOfFreedom):
965        throw DudleyAdapterException("Error - Dudley does not support interpolation from reduced degrees of freedom to degrees of freedom");        throw DudleyException("Dudley does not support interpolation from reduced degrees of freedom to degrees of freedom");
966        break;        break;
967        case(ReducedDegreesOfFreedom):        case(ReducedDegreesOfFreedom):
968        Dudley_Assemble_CopyNodalData(mesh->Nodes,&target,&in);        Assemble_CopyNodalData(mesh->Nodes,&target,&in);
969        break;        break;
970        case(Elements):        case(Elements):
971        case(ReducedElements):        case(ReducedElements):
972        if (getMPISize()>1) {        if (getMPISize()>1) {
973           escript::Data temp=escript::Data( in,  reducedContinuousFunction(*this) );           escript::Data temp=escript::Data( in,  reducedContinuousFunction(*this) );
974           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&temp,&target);           Assemble_interpolate(mesh->Nodes,mesh->Elements,&temp,&target);
975        } else {        } else {
976           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);           Assemble_interpolate(mesh->Nodes,mesh->Elements,&in,&target);
977        }        }
978        break;        break;
979        case(FaceElements):        case(FaceElements):
980        case(ReducedFaceElements):        case(ReducedFaceElements):
981        if (getMPISize()>1) {        if (getMPISize()>1) {
982           escript::Data temp=escript::Data( in,  reducedContinuousFunction(*this) );           escript::Data temp=escript::Data( in,  reducedContinuousFunction(*this) );
983           Dudley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&temp,&target);           Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&temp,&target);
984        } else {        } else {
985           Dudley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);           Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&in,&target);
986        }        }
987        break;        break;
988        case(Points):        case(Points):
989        if (getMPISize()>1) {        if (getMPISize()>1) {
990           escript::Data temp=escript::Data( in,  reducedContinuousFunction(*this) );           escript::Data temp=escript::Data( in,  reducedContinuousFunction(*this) );
991           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Points,&temp,&target);           Assemble_interpolate(mesh->Nodes,mesh->Points,&temp,&target);
992        } else {        } else {
993           Dudley_Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);           Assemble_interpolate(mesh->Nodes,mesh->Points,&in,&target);
994        }        }
995        break;        break;
996        default:        default:
997           stringstream temp;           stringstream temp;
998           temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();           temp << "Interpolation On Domain: Dudley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
999           throw DudleyAdapterException(temp.str());           throw DudleyException(temp.str());
1000           break;           break;
1001        }        }
1002        break;        break;
1003     default:     default:
1004        stringstream temp;        stringstream temp;
1005        temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type %d" << in.getFunctionSpace().getTypeCode();        temp << "Interpolation On Domain: Dudley does not know anything about function space type %d" << in.getFunctionSpace().getTypeCode();
1006        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1007        break;        break;
1008     }     }
    checkDudleyError();  
1009  }  }
1010    
1011  //  //
# Line 1024  void MeshAdapter::setToX(escript::Data& Line 1015  void MeshAdapter::setToX(escript::Data&
1015  {  {
1016     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1017     if (argDomain!=*this)     if (argDomain!=*this)
1018        throw DudleyAdapterException("Error - Illegal domain of data point locations");        throw DudleyException("Illegal domain of data point locations");
1019     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1020     // in case of values node coordinates we can do the job directly:     // in case of values node coordinates we can do the job directly:
1021     if (arg.getFunctionSpace().getTypeCode()==Nodes) {     if (arg.getFunctionSpace().getTypeCode()==Nodes) {
1022        Dudley_Assemble_NodeCoordinates(mesh->Nodes,&arg);        Assemble_NodeCoordinates(mesh->Nodes,&arg);
1023     } else {     } else {
1024        escript::Data tmp_data=Vector(0.0,continuousFunction(*this),true);        escript::Data tmp_data=Vector(0.0,continuousFunction(*this),true);
1025        Dudley_Assemble_NodeCoordinates(mesh->Nodes,&tmp_data);        Assemble_NodeCoordinates(mesh->Nodes,&tmp_data);
1026        // this is then interpolated onto arg:        // this is then interpolated onto arg:
1027        interpolateOnDomain(arg,tmp_data);        interpolateOnDomain(arg,tmp_data);
1028     }     }
    checkDudleyError();  
1029  }  }
1030    
1031  //  //
# Line 1046  void MeshAdapter::setToNormal(escript::D Line 1036  void MeshAdapter::setToNormal(escript::D
1036  /*   const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());*/  /*   const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());*/
1037     const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(*(normal.getFunctionSpace().getDomain()));     const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(*(normal.getFunctionSpace().getDomain()));
1038     if (normalDomain!=*this)     if (normalDomain!=*this)
1039        throw DudleyAdapterException("Error - Illegal domain of normal locations");        throw DudleyException("Illegal domain of normal locations");
1040     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1041     switch(normal.getFunctionSpace().getTypeCode()) {     switch(normal.getFunctionSpace().getTypeCode()) {
1042     case(Nodes):     case(Nodes):
1043     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for nodes");     throw DudleyException("Dudley does not support surface normal vectors for nodes");
1044     break;     break;
1045     case(ReducedNodes):     case(ReducedNodes):
1046     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for reduced nodes");     throw DudleyException("Dudley does not support surface normal vectors for reduced nodes");
1047     break;     break;
1048     case(Elements):     case(Elements):
1049     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for elements");     throw DudleyException("Dudley does not support surface normal vectors for elements");
1050     break;     break;
1051     case(ReducedElements):     case(ReducedElements):
1052     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for elements with reduced integration order");     throw DudleyException("Dudley does not support surface normal vectors for elements with reduced integration order");
1053     break;     break;
1054     case (FaceElements):     case (FaceElements):
1055     Dudley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&normal);     Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&normal);
1056     break;     break;
1057     case (ReducedFaceElements):     case (ReducedFaceElements):
1058     Dudley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&normal);     Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&normal);
1059     break;     break;
1060     case(Points):     case(Points):
1061     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for point elements");     throw DudleyException("Dudley does not support surface normal vectors for point elements");
1062     break;     break;
1063     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1064     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for degrees of freedom.");     throw DudleyException("Dudley does not support surface normal vectors for degrees of freedom.");
1065     break;     break;
1066     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1067     throw DudleyAdapterException("Error - Dudley does not support surface normal vectors for reduced degrees of freedom.");     throw DudleyException("Dudley does not support surface normal vectors for reduced degrees of freedom.");
1068     break;     break;
1069     default:     default:
1070        stringstream temp;        stringstream temp;
1071        temp << "Error - Normal Vectors: Dudley does not know anything about function space type " << normal.getFunctionSpace().getTypeCode();        temp << "Normal Vectors: Dudley does not know anything about function space type " << normal.getFunctionSpace().getTypeCode();
1072        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1073        break;        break;
1074     }     }
    checkDudleyError();  
1075  }  }
1076    
1077  //  //
# Line 1093  void MeshAdapter::interpolateAcross(escr Line 1082  void MeshAdapter::interpolateAcross(escr
1082     const_Domain_ptr targetDomain_p=target.getFunctionSpace().getDomain();     const_Domain_ptr targetDomain_p=target.getFunctionSpace().getDomain();
1083     const MeshAdapter* targetDomain=dynamic_cast<const MeshAdapter*>(targetDomain_p.get());     const MeshAdapter* targetDomain=dynamic_cast<const MeshAdapter*>(targetDomain_p.get());
1084     if (targetDomain!=this)     if (targetDomain!=this)
1085        throw DudleyAdapterException("Error - Illegal domain of interpolation target");        throw DudleyException("Illegal domain of interpolation target");
1086    
1087     throw DudleyAdapterException("Error - Dudley does not allow interpolation across domains yet.");     throw DudleyException("Dudley does not allow interpolation across domains yet.");
1088  }  }
1089    
1090  //  //
# Line 1105  void MeshAdapter::setToIntegrals(vector< Line 1094  void MeshAdapter::setToIntegrals(vector<
1094  {  {
1095     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1096     if (argDomain!=*this)     if (argDomain!=*this)
1097        throw DudleyAdapterException("Error - Illegal domain of integration kernel");        throw DudleyException("Illegal domain of integration kernel");
1098    
1099     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1100     escript::Data temp;     escript::Data temp;
1101     switch(arg.getFunctionSpace().getTypeCode()) {     switch(arg.getFunctionSpace().getTypeCode()) {
1102     case(Nodes):     case(Nodes):
1103     temp=escript::Data( arg, escript::function(*this) );     temp=escript::Data( arg, escript::function(*this) );
1104     Dudley_Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);
1105     break;     break;
1106     case(ReducedNodes):     case(ReducedNodes):
1107     temp=escript::Data( arg, escript::function(*this) );     temp=escript::Data( arg, escript::function(*this) );
1108     Dudley_Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);
1109     break;     break;
1110     case(Elements):     case(Elements):
1111     Dudley_Assemble_integrate(mesh->Nodes,mesh->Elements,&arg,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->Elements,&arg,&integrals[0]);
1112     break;     break;
1113     case(ReducedElements):     case(ReducedElements):
1114     Dudley_Assemble_integrate(mesh->Nodes,mesh->Elements,&arg,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->Elements,&arg,&integrals[0]);
1115     break;     break;
1116     case(FaceElements):     case(FaceElements):
1117     Dudley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&arg,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->FaceElements,&arg,&integrals[0]);
1118     break;     break;
1119     case(ReducedFaceElements):     case(ReducedFaceElements):
1120     Dudley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&arg,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->FaceElements,&arg,&integrals[0]);
1121     break;     break;
1122     case(Points):     case(Points):
1123     throw DudleyAdapterException("Error - Integral of data on points is not supported.");     throw DudleyException("Integral of data on points is not supported.");
1124     break;     break;
1125     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1126     temp=escript::Data( arg, escript::function(*this) );     temp=escript::Data( arg, escript::function(*this) );
1127     Dudley_Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);
1128     break;     break;
1129     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1130     temp=escript::Data( arg, escript::function(*this) );     temp=escript::Data( arg, escript::function(*this) );
1131     Dudley_Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);     Assemble_integrate(mesh->Nodes,mesh->Elements,&temp,&integrals[0]);
1132     break;     break;
1133     default:     default:
1134        stringstream temp;        stringstream temp;
1135        temp << "Error - Integrals: Dudley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();        temp << "Integrals: Dudley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();
1136        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1137        break;        break;
1138     }     }
    checkDudleyError();  
1139  }  }
1140    
1141  //  //
# Line 1157  void MeshAdapter::setToGradient(escript: Line 1145  void MeshAdapter::setToGradient(escript:
1145  {  {
1146     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1147     if (argDomain!=*this)     if (argDomain!=*this)
1148        throw DudleyAdapterException("Error - Illegal domain of gradient argument");        throw DudleyException("Illegal domain of gradient argument");
1149     const MeshAdapter& gradDomain=dynamic_cast<const MeshAdapter&>(*(grad.getFunctionSpace().getDomain()));     const MeshAdapter& gradDomain=dynamic_cast<const MeshAdapter&>(*(grad.getFunctionSpace().getDomain()));
1150     if (gradDomain!=*this)     if (gradDomain!=*this)
1151        throw DudleyAdapterException("Error - Illegal domain of gradient");        throw DudleyException("Illegal domain of gradient");
1152    
1153     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1154     const escript::Data* nodeData=0;     const escript::Data* nodeData=0;
# Line 1180  void MeshAdapter::setToGradient(escript: Line 1168  void MeshAdapter::setToGradient(escript:
1168     }     }
1169     switch(grad.getFunctionSpace().getTypeCode()) {     switch(grad.getFunctionSpace().getTypeCode()) {
1170     case(Nodes):     case(Nodes):
1171     throw DudleyAdapterException("Error - Gradient at nodes is not supported.");     throw DudleyException("Gradient at nodes is not supported.");
1172     break;     break;
1173     case(ReducedNodes):     case(ReducedNodes):
1174     throw DudleyAdapterException("Error - Gradient at reduced nodes is not supported.");     throw DudleyException("Gradient at reduced nodes is not supported.");
1175     break;     break;
1176     case(Elements):     case(Elements):
1177     Dudley_Assemble_gradient(mesh->Nodes,mesh->Elements,&grad, nodeData);     Assemble_gradient(mesh->Nodes,mesh->Elements,&grad, nodeData);
1178     break;     break;
1179     case(ReducedElements):     case(ReducedElements):
1180     Dudley_Assemble_gradient(mesh->Nodes,mesh->Elements,&grad, nodeData);     Assemble_gradient(mesh->Nodes,mesh->Elements,&grad, nodeData);
1181     break;     break;
1182     case(FaceElements):     case(FaceElements):
1183     Dudley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&grad, nodeData);     Assemble_gradient(mesh->Nodes,mesh->FaceElements,&grad, nodeData);
1184     break;     break;
1185     case(ReducedFaceElements):     case(ReducedFaceElements):
1186     Dudley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&grad, nodeData);     Assemble_gradient(mesh->Nodes,mesh->FaceElements,&grad, nodeData);
1187     break;     break;
1188     case(Points):     case(Points):
1189     throw DudleyAdapterException("Error - Gradient at points is not supported.");     throw DudleyException("Gradient at points is not supported.");
1190     break;     break;
1191     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1192     throw DudleyAdapterException("Error - Gradient at degrees of freedom is not supported.");     throw DudleyException("Gradient at degrees of freedom is not supported.");
1193     break;     break;
1194     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1195     throw DudleyAdapterException("Error - Gradient at reduced degrees of freedom is not supported.");     throw DudleyException("Gradient at reduced degrees of freedom is not supported.");
1196     break;     break;
1197     default:     default:
1198        stringstream temp;        stringstream temp;
1199        temp << "Error - Gradient: Dudley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();        temp << "Gradient: Dudley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();
1200        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1201        break;        break;
1202     }     }
    checkDudleyError();  
1203  }  }
1204    
1205  //  //
# Line 1223  void MeshAdapter::setToSize(escript::Dat Line 1210  void MeshAdapter::setToSize(escript::Dat
1210     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1211     switch(size.getFunctionSpace().getTypeCode()) {     switch(size.getFunctionSpace().getTypeCode()) {
1212     case(Nodes):     case(Nodes):
1213     throw DudleyAdapterException("Error - Size of nodes is not supported.");     throw DudleyException("Size of nodes is not supported.");
1214     break;     break;
1215     case(ReducedNodes):     case(ReducedNodes):
1216     throw DudleyAdapterException("Error - Size of reduced nodes is not supported.");     throw DudleyException("Size of reduced nodes is not supported.");
1217     break;     break;
1218     case(Elements):     case(Elements):
1219     Dudley_Assemble_getSize(mesh->Nodes,mesh->Elements,&size);     Assemble_getSize(mesh->Nodes,mesh->Elements,&size);
1220     break;     break;
1221     case(ReducedElements):     case(ReducedElements):
1222     Dudley_Assemble_getSize(mesh->Nodes,mesh->Elements,&size);     Assemble_getSize(mesh->Nodes,mesh->Elements,&size);
1223     break;     break;
1224     case(FaceElements):     case(FaceElements):
1225     Dudley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&size);     Assemble_getSize(mesh->Nodes,mesh->FaceElements,&size);
1226     break;     break;
1227     case(ReducedFaceElements):     case(ReducedFaceElements):
1228     Dudley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&size);     Assemble_getSize(mesh->Nodes,mesh->FaceElements,&size);
1229     break;     break;
1230     case(Points):     case(Points):
1231     throw DudleyAdapterException("Error - Size of point elements is not supported.");     throw DudleyException("Size of point elements is not supported.");
1232     break;     break;
1233     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1234     throw DudleyAdapterException("Error - Size of degrees of freedom is not supported.");     throw DudleyException("Size of degrees of freedom is not supported.");
1235     break;     break;
1236     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1237     throw DudleyAdapterException("Error - Size of reduced degrees of freedom is not supported.");     throw DudleyException("Size of reduced degrees of freedom is not supported.");
1238     break;     break;
1239     default:     default:
1240        stringstream temp;        stringstream temp;
1241        temp << "Error - Element size: Dudley does not know anything about function space type " << size.getFunctionSpace().getTypeCode();        temp << "Element size: Dudley does not know anything about function space type " << size.getFunctionSpace().getTypeCode();
1242        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1243        break;        break;
1244     }     }
    checkDudleyError();  
1245  }  }
1246    
1247  //  //
# Line 1266  void MeshAdapter::setNewX(const escript: Line 1252  void MeshAdapter::setNewX(const escript:
1252     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1253     const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(*(new_x.getFunctionSpace().getDomain()));     const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(*(new_x.getFunctionSpace().getDomain()));
1254     if (newDomain!=*this)     if (newDomain!=*this)
1255        throw DudleyAdapterException("Error - Illegal domain of new point locations");        throw DudleyException("Illegal domain of new point locations");
1256     if ( new_x.getFunctionSpace() == continuousFunction(*this) ) {     if ( new_x.getFunctionSpace() == continuousFunction(*this) ) {
1257         Dudley_Mesh_setCoordinates(mesh,&new_x);         Dudley_Mesh_setCoordinates(mesh,&new_x);
1258     } else {     } else {
1259         throw DudleyAdapterException("As of version escript3.3 - SetNewX only accepts ContinuousFunction arguments please interpolate.");               throw DudleyException("As of version escript3.3 - SetNewX only accepts ContinuousFunction arguments please interpolate.");      
1260    
1261     }     }
    checkDudleyError();  
1262  }  }
1263    
1264  bool MeshAdapter::ownSample(int fs_code, index_t id) const  bool MeshAdapter::ownSample(int fs_code, index_t id) const
# Line 1297  bool MeshAdapter::ownSample(int fs_code, Line 1282  bool MeshAdapter::ownSample(int fs_code,
1282          }          }
1283          else          else
1284          {          {
1285              throw DudleyAdapterException("unsupported function space type for ownSample()");              throw DudleyException("unsupported function space type for ownSample()");
1286          }          }
1287          k=globalNodeIndex[id];          k=globalNodeIndex[id];
1288          return static_cast<bool>( (myFirstNode <= k) && (k < myLastNode) );          return static_cast<bool>( (myFirstNode <= k) && (k < myLastNode) );
# Line 1322  ASM_ptr MeshAdapter::newSystemMatrix(con Line 1307  ASM_ptr MeshAdapter::newSystemMatrix(con
1307     // is the domain right?     // is the domain right?
1308     const MeshAdapter& row_domain=dynamic_cast<const MeshAdapter&>(*(row_functionspace.getDomain()));     const MeshAdapter& row_domain=dynamic_cast<const MeshAdapter&>(*(row_functionspace.getDomain()));
1309     if (row_domain!=*this)     if (row_domain!=*this)
1310        throw DudleyAdapterException("Error - domain of row function space does not match the domain of matrix generator.");        throw DudleyException("domain of row function space does not match the domain of matrix generator.");
1311     const MeshAdapter& col_domain=dynamic_cast<const MeshAdapter&>(*(column_functionspace.getDomain()));     const MeshAdapter& col_domain=dynamic_cast<const MeshAdapter&>(*(column_functionspace.getDomain()));
1312     if (col_domain!=*this)     if (col_domain!=*this)
1313        throw DudleyAdapterException("Error - domain of column function space does not match the domain of matrix generator.");        throw DudleyException("domain of column function space does not match the domain of matrix generator.");
1314     // is the function space type right     // is the function space type right
1315     if (row_functionspace.getTypeCode()==DegreesOfFreedom) {     if (row_functionspace.getTypeCode()==DegreesOfFreedom) {
1316        reduceRowOrder=0;        reduceRowOrder=0;
1317     } else if (row_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {     } else if (row_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {
1318        reduceRowOrder=1;        reduceRowOrder=1;
1319     } else {     } else {
1320        throw DudleyAdapterException("Error - illegal function space type for system matrix rows.");        throw DudleyException("illegal function space type for system matrix rows.");
1321     }     }
1322     if (column_functionspace.getTypeCode()==DegreesOfFreedom) {     if (column_functionspace.getTypeCode()==DegreesOfFreedom) {
1323        reduceColOrder=0;        reduceColOrder=0;
1324     } else if (column_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {     } else if (column_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {
1325        reduceColOrder=1;        reduceColOrder=1;
1326     } else {     } else {
1327        throw DudleyAdapterException("Error - illegal function space type for system matrix columns.");        throw DudleyException("illegal function space type for system matrix columns.");
1328     }     }
1329     // generate matrix:     // generate matrix:
1330    
1331     paso::SystemMatrixPattern_ptr fsystemMatrixPattern(Dudley_getPattern(getDudley_Mesh(),reduceRowOrder,reduceColOrder));     paso::SystemMatrixPattern_ptr fsystemMatrixPattern(Dudley_getPattern(getDudley_Mesh(),reduceRowOrder,reduceColOrder));
    checkDudleyError();  
1332     paso::SystemMatrix_ptr sm;     paso::SystemMatrix_ptr sm;
1333     int trilinos = 0;     int trilinos = 0;
1334     if (trilinos) {     if (trilinos) {
# Line 1357  ASM_ptr MeshAdapter::newSystemMatrix(con Line 1341  ASM_ptr MeshAdapter::newSystemMatrix(con
1341                    row_blocksize, column_blocksize, false, row_functionspace,                    row_blocksize, column_blocksize, false, row_functionspace,
1342                    column_functionspace));                    column_functionspace));
1343     }     }
    checkPasoError();  
1344     return sm;     return sm;
1345  }  }
1346    
# Line 1372  ATP_ptr MeshAdapter::newTransportProblem Line 1355  ATP_ptr MeshAdapter::newTransportProblem
1355     // is the domain right?     // is the domain right?
1356     const MeshAdapter& domain=dynamic_cast<const MeshAdapter&>(*(fs.getDomain()));     const MeshAdapter& domain=dynamic_cast<const MeshAdapter&>(*(fs.getDomain()));
1357     if (domain!=*this)     if (domain!=*this)
1358        throw DudleyAdapterException("Error - domain of function space does not match the domain of transport problem generator.");        throw DudleyException("domain of function space does not match the domain of transport problem generator.");
1359     // is the function space type right     // is the function space type right
1360     if (fs.getTypeCode()==DegreesOfFreedom) {     if (fs.getTypeCode()==DegreesOfFreedom) {
1361        reduceOrder=0;        reduceOrder=0;
1362     } else if (fs.getTypeCode()==ReducedDegreesOfFreedom) {     } else if (fs.getTypeCode()==ReducedDegreesOfFreedom) {
1363        reduceOrder=1;        reduceOrder=1;
1364     } else {     } else {
1365        throw DudleyAdapterException("Error - illegal function space type for system matrix rows.");        throw DudleyException("illegal function space type for system matrix rows.");
1366     }     }
1367     // generate matrix:     // generate matrix:
1368    
1369     paso::SystemMatrixPattern_ptr fsystemMatrixPattern(Dudley_getPattern(     paso::SystemMatrixPattern_ptr fsystemMatrixPattern(Dudley_getPattern(
1370                 getDudley_Mesh(),reduceOrder,reduceOrder));                 getDudley_Mesh(),reduceOrder,reduceOrder));
    checkDudleyError();  
1371     paso::TransportProblem_ptr transportProblem(new paso::TransportProblem(     paso::TransportProblem_ptr transportProblem(new paso::TransportProblem(
1372                                              fsystemMatrixPattern, blocksize,                                              fsystemMatrixPattern, blocksize,
1373                                              fs));                                              fs));
    checkPasoError();  
1374     return transportProblem;     return transportProblem;
1375  }  }
1376    
# Line 1417  bool MeshAdapter::isCellOriented(int fun Line 1398  bool MeshAdapter::isCellOriented(int fun
1398     break;     break;
1399     default:     default:
1400        stringstream temp;        stringstream temp;
1401        temp << "Error - Cell: Dudley does not know anything about function space type " << functionSpaceCode;        temp << "Cell: Dudley does not know anything about function space type " << functionSpaceCode;
1402        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1403        break;        break;
1404     }     }
    checkDudleyError();  
1405     return false;     return false;
1406  }  }
1407    
# Line 1531  MeshAdapter::commonFunctionSpace(const v Line 1511  MeshAdapter::commonFunctionSpace(const v
1511          else    // so we must be in line3          else    // so we must be in line3
1512          {          {
1513    
1514              throw DudleyAdapterException("Programmer Error - choosing between contact elements - we should never get here.");              throw DudleyException("choosing between contact elements - we should never get here.");
1515    
1516          }          }
1517      }      }
# Line 1582  bool MeshAdapter::probeInterpolationOnDo Line 1562  bool MeshAdapter::probeInterpolationOnDo
1562          return true;          return true;
1563          default:          default:
1564                stringstream temp;                stringstream temp;
1565                temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;                temp << "Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;
1566                throw DudleyAdapterException(temp.str());                throw DudleyException(temp.str());
1567     }     }
1568     break;     break;
1569     case(ReducedNodes):     case(ReducedNodes):
# Line 1601  bool MeshAdapter::probeInterpolationOnDo Line 1581  bool MeshAdapter::probeInterpolationOnDo
1581          return false;          return false;
1582          default:          default:
1583                  stringstream temp;                  stringstream temp;
1584                  temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;                  temp << "Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;
1585                  throw DudleyAdapterException(temp.str());                  throw DudleyException(temp.str());
1586     }     }
1587     break;     break;
1588     case(Elements):     case(Elements):
# Line 1653  bool MeshAdapter::probeInterpolationOnDo Line 1633  bool MeshAdapter::probeInterpolationOnDo
1633          return true;          return true;
1634          default:          default:
1635                  stringstream temp;                  stringstream temp;
1636                  temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;                  temp << "Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;
1637                  throw DudleyAdapterException(temp.str());                  throw DudleyException(temp.str());
1638          }          }
1639          break;          break;
1640     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
# Line 1672  bool MeshAdapter::probeInterpolationOnDo Line 1652  bool MeshAdapter::probeInterpolationOnDo
1652          return false;          return false;
1653          default:          default:
1654                  stringstream temp;                  stringstream temp;
1655                  temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;                  temp << "Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_target;
1656                  throw DudleyAdapterException(temp.str());                  throw DudleyException(temp.str());
1657          }          }
1658          break;          break;
1659     default:     default:
1660        stringstream temp;        stringstream temp;
1661        temp << "Error - Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_source;        temp << "Interpolation On Domain: Dudley does not know anything about function space type " << functionSpaceType_source;
1662        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1663        break;        break;
1664     }     }
    checkDudleyError();  
1665     return false;     return false;
1666  }  }
1667    
# Line 1772  const int* MeshAdapter::borrowSampleRefe Line 1751  const int* MeshAdapter::borrowSampleRefe
1751     break;     break;
1752     default:     default:
1753        stringstream temp;        stringstream temp;
1754        temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();        temp << "Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
1755        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1756        break;        break;
1757     }     }
1758     return out;     return out;
# Line 1787  int MeshAdapter::getTagFromSampleNo(int Line 1766  int MeshAdapter::getTagFromSampleNo(int
1766     out=mesh->Nodes->Tag[sampleNo];     out=mesh->Nodes->Tag[sampleNo];
1767     break;     break;
1768     case(ReducedNodes):     case(ReducedNodes):
1769     throw DudleyAdapterException(" Error - ReducedNodes does not support tags.");     throw DudleyException("ReducedNodes does not support tags.");
1770     break;     break;
1771     case(Elements):     case(Elements):
1772     out=mesh->Elements->Tag[sampleNo];     out=mesh->Elements->Tag[sampleNo];
# Line 1805  int MeshAdapter::getTagFromSampleNo(int Line 1784  int MeshAdapter::getTagFromSampleNo(int
1784     out=mesh->Points->Tag[sampleNo];     out=mesh->Points->Tag[sampleNo];
1785     break;     break;
1786     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1787     throw DudleyAdapterException(" Error - DegreesOfFreedom does not support tags.");     throw DudleyException("DegreesOfFreedom does not support tags.");
1788     break;     break;
1789     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1790     throw DudleyAdapterException(" Error - ReducedDegreesOfFreedom does not support tags.");     throw DudleyException("ReducedDegreesOfFreedom does not support tags.");
1791     break;     break;
1792     default:     default:
1793        stringstream temp;        stringstream temp;
1794        temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();        temp << "Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
1795        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1796        break;        break;
1797     }     }
1798     return out;     return out;
# Line 1828  void MeshAdapter::setTags(const int func Line 1807  void MeshAdapter::setTags(const int func
1807     Dudley_NodeFile_setTags(mesh->Nodes,newTag,&mask);     Dudley_NodeFile_setTags(mesh->Nodes,newTag,&mask);
1808     break;     break;
1809     case(ReducedNodes):     case(ReducedNodes):
1810     throw DudleyAdapterException("Error - ReducedNodes does not support tags");     throw DudleyException("ReducedNodes does not support tags");
1811     break;     break;
1812     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1813     throw DudleyAdapterException("Error - DegreesOfFreedom does not support tags");     throw DudleyException("DegreesOfFreedom does not support tags");
1814     break;     break;
1815     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1816     throw DudleyAdapterException("Error - ReducedDegreesOfFreedom does not support tags");     throw DudleyException("ReducedDegreesOfFreedom does not support tags");
1817     break;     break;
1818     case(Elements):     case(Elements):
1819     Dudley_ElementFile_setTags(mesh->Elements,newTag,&mask);     Dudley_ElementFile_setTags(mesh->Elements,newTag,&mask);
# Line 1853  void MeshAdapter::setTags(const int func Line 1832  void MeshAdapter::setTags(const int func
1832     break;     break;
1833     default:     default:
1834        stringstream temp;        stringstream temp;
1835        temp << "Error - Dudley does not know anything about function space type " << functionSpaceType;        temp << "Dudley does not know anything about function space type " << functionSpaceType;
1836        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1837     }     }
    checkDudleyError();  
    return;  
1838  }  }
1839    
1840  void MeshAdapter::setTagMap(const string& name,  int tag)  void MeshAdapter::setTagMap(const string& name,  int tag)
1841  {  {
1842     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1843     Dudley_Mesh_addTagMap(mesh, name.c_str(),tag);     Dudley_Mesh_addTagMap(mesh, name.c_str(),tag);
    checkDudleyError();  
    // throwStandardException("MeshAdapter::set TagMap is not implemented.");  
1844  }  }
1845    
1846  int MeshAdapter::getTag(const string& name) const  int MeshAdapter::getTag(const string& name) const
# Line 1873  int MeshAdapter::getTag(const string& na Line 1848  int MeshAdapter::getTag(const string& na
1848     Dudley_Mesh* mesh=m_dudleyMesh.get();     Dudley_Mesh* mesh=m_dudleyMesh.get();
1849     int tag=0;     int tag=0;
1850     tag=Dudley_Mesh_getTag(mesh, name.c_str());     tag=Dudley_Mesh_getTag(mesh, name.c_str());
    checkDudleyError();  
    // throwStandardException("MeshAdapter::getTag is not implemented.");  
1851     return tag;     return tag;
1852  }  }
1853    
# Line 1906  int MeshAdapter::getNumberOfTagsInUse(in Line 1879  int MeshAdapter::getNumberOfTagsInUse(in
1879            numTags=mesh->Nodes->numTagsInUse;            numTags=mesh->Nodes->numTagsInUse;
1880            break;            break;
1881     case(ReducedNodes):     case(ReducedNodes):
1882            throw DudleyAdapterException("Error - ReducedNodes does not support tags");            throw DudleyException("ReducedNodes does not support tags");
1883            break;            break;
1884     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1885            throw DudleyAdapterException("Error - DegreesOfFreedom does not support tags");            throw DudleyException("DegreesOfFreedom does not support tags");
1886            break;            break;
1887     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1888            throw DudleyAdapterException("Error - ReducedDegreesOfFreedom does not support tags");            throw DudleyException("ReducedDegreesOfFreedom does not support tags");
1889            break;            break;
1890     case(Elements):     case(Elements):
1891     case(ReducedElements):     case(ReducedElements):
# Line 1927  int MeshAdapter::getNumberOfTagsInUse(in Line 1900  int MeshAdapter::getNumberOfTagsInUse(in
1900            break;            break;
1901     default:     default:
1902        stringstream temp;        stringstream temp;
1903        temp << "Error - Dudley does not know anything about function space type " << functionSpaceCode;        temp << "Dudley does not know anything about function space type " << functionSpaceCode;
1904        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1905    }    }
1906    return numTags;    return numTags;
1907  }  }
# Line 1942  const int* MeshAdapter::borrowListOfTags Line 1915  const int* MeshAdapter::borrowListOfTags
1915            tags=mesh->Nodes->tagsInUse;            tags=mesh->Nodes->tagsInUse;
1916            break;            break;
1917     case(ReducedNodes):     case(ReducedNodes):
1918            throw DudleyAdapterException("Error - ReducedNodes does not support tags");            throw DudleyException("ReducedNodes does not support tags");
1919            break;            break;
1920     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1921            throw DudleyAdapterException("Error - DegreesOfFreedom does not support tags");            throw DudleyException("DegreesOfFreedom does not support tags");
1922            break;            break;
1923     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1924            throw DudleyAdapterException("Error - ReducedDegreesOfFreedom does not support tags");            throw DudleyException("ReducedDegreesOfFreedom does not support tags");
1925            break;            break;
1926     case(Elements):     case(Elements):
1927     case(ReducedElements):     case(ReducedElements):
# Line 1963  const int* MeshAdapter::borrowListOfTags Line 1936  const int* MeshAdapter::borrowListOfTags
1936            break;            break;
1937     default:     default:
1938        stringstream temp;        stringstream temp;
1939        temp << "Error - Dudley does not know anything about function space type " << functionSpaceCode;        temp << "Dudley does not know anything about function space type " << functionSpaceCode;
1940        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1941    }    }
1942    return tags;    return tags;
1943  }  }
# Line 2020  int MeshAdapter::getApproximationOrder(c Line 1993  int MeshAdapter::getApproximationOrder(c
1993            break;            break;
1994     default:     default:
1995        stringstream temp;        stringstream temp;
1996        temp << "Error - Dudley does not know anything about function space type " << functionSpaceCode;        temp << "Dudley does not know anything about function space type " << functionSpaceCode;
1997        throw DudleyAdapterException(temp.str());        throw DudleyException(temp.str());
1998    }    }
1999    return order;    return order;
2000  }  }
# Line 2045  escript::Data MeshAdapter::randomFill(co Line 2018  escript::Data MeshAdapter::randomFill(co
2018      return towipe;            return towipe;      
2019  }  }
2020    
2021    } // end of namespace
2022    
 }  // end of namespace  

Legend:
Removed from v.6008  
changed lines
  Added in v.6009

  ViewVC Help
Powered by ViewVC 1.1.26