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

Diff of /branches/diaplayground/finley/src/CPPAdapter/MeshAdapter.cpp

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

trunk/esys2/finley/src/CPPAdapter/MeshAdapter.cpp revision 149 by jgs, Thu Sep 1 03:31:39 2005 UTC trunk/finley/src/finley/CPPAdapter/MeshAdapter.cpp revision 201 by jgs, Wed Nov 23 04:10:21 2005 UTC
# Line 17  extern "C" { Line 17  extern "C" {
17  #include "finley/finleyC/Assemble.h"  #include "finley/finleyC/Assemble.h"
18  #include "finley/finleyC/Mesh.h"  #include "finley/finleyC/Mesh.h"
19  #include "finley/finleyC/Finley.h"  #include "finley/finleyC/Finley.h"
20  #include "finley/finleyC/System.h"  #include "paso/SystemMatrix.h"
21  }  }
22  #include "finley/CPPAdapter/SystemMatrixAdapter.h"  #include "finley/CPPAdapter/SystemMatrixAdapter.h"
23  #include "finley/CPPAdapter/MeshAdapter.h"  #include "finley/CPPAdapter/MeshAdapter.h"
# Line 28  extern "C" { Line 28  extern "C" {
28  #include "escript/Data/DataArrayView.h"  #include "escript/Data/DataArrayView.h"
29  #include "escript/Data/FunctionSpace.h"  #include "escript/Data/FunctionSpace.h"
30  #include "escript/Data/DataFactory.h"  #include "escript/Data/DataFactory.h"
31    #include <boost/python/extract.hpp>
32    
33  #include <iostream>  #include <iostream>
 #include <vector>  
34  #include <sstream>  #include <sstream>
35    
36  using namespace std;  using namespace std;
# Line 241  void MeshAdapter::getTagList(int functio Line 241  void MeshAdapter::getTagList(int functio
241      break;      break;
242    default:    default:
243      stringstream temp;      stringstream temp;
244      temp << "Error - Invalid function space type: "      temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
      << functionSpaceType << " for domain: " << getDescription();  
245      throw FinleyAdapterException(temp.str());      throw FinleyAdapterException(temp.str());
246      break;      break;
247    }    }
# Line 314  void MeshAdapter::getReferenceNoList(int Line 313  void MeshAdapter::getReferenceNoList(int
313      break;      break;
314    default:    default:
315      stringstream temp;      stringstream temp;
316      temp << "Error - Invalid function space type: "      temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
      << functionSpaceType << " for domain: " << getDescription();  
317      throw FinleyAdapterException(temp.str());      throw FinleyAdapterException(temp.str());
318      break;      break;
319    }    }
# Line 395  pair<int,int> MeshAdapter::getDataShape( Line 393  pair<int,int> MeshAdapter::getDataShape(
393             break;             break;
394        default:        default:
395          stringstream temp;          stringstream temp;
396          temp << "Error - Invalid function space type: "          temp << "Error - Invalid function space type: " << functionSpaceCode << " for domain: " << getDescription();
          << functionSpaceCode << " for domain: " << getDescription();  
397          throw FinleyAdapterException(temp.str());          throw FinleyAdapterException(temp.str());
398          break;          break;
399        }        }
# Line 413  void MeshAdapter::addPDEToSystem( Line 410  void MeshAdapter::addPDEToSystem(
410                       const Data& d_contact,const Data& y_contact) const                       const Data& d_contact,const Data& y_contact) const
411  {  {
412     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
413     Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,mat.getFinley_SystemMatrix(),&(rhs.getDataC()),     Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,mat.getPaso_SystemMatrix(),&(rhs.getDataC()),
414                         &(A.getDataC()),&(B.getDataC()),&(C.getDataC()),&(D.getDataC()),&(X.getDataC()),&(Y.getDataC()));                         &(A.getDataC()),&(B.getDataC()),&(C.getDataC()),&(D.getDataC()),&(X.getDataC()),&(Y.getDataC()));
415     checkFinleyError();     checkFinleyError();
416     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->FaceElements,
417                    mat.getFinley_SystemMatrix(),                    mat.getPaso_SystemMatrix(),
418                    &(rhs.getDataC()),                    &(rhs.getDataC()),
419                                    &(d.getDataC()),&(y.getDataC()),                                    &(d.getDataC()),&(y.getDataC()),
420                                    Finley_Assemble_handelShapeMissMatch_Mean_out);                                    Finley_Assemble_handelShapeMissMatch_Mean_out);
421     checkFinleyError();     checkFinleyError();
422     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->ContactElements,     Finley_Assemble_RobinCondition(mesh->Nodes,mesh->ContactElements,
423                    mat.getFinley_SystemMatrix(),                    mat.getPaso_SystemMatrix(),
424                    &(rhs.getDataC()),                    &(rhs.getDataC()),
425                                    &(d_contact.getDataC()),                                    &(d_contact.getDataC()),
426                    &(y_contact.getDataC()),                    &(y_contact.getDataC()),
# Line 489  void MeshAdapter::interpolateOnDomain(Da Line 486  void MeshAdapter::interpolateOnDomain(Da
486                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));
487                 break;                 break;
488             default:             default:
489                 Finley_ErrorCode=TYPE_ERROR;                 stringstream temp;
490                 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();
491                   throw FinleyAdapterException(temp.str());
492                 break;                 break;
493          }          }
494          break;          break;
# Line 498  void MeshAdapter::interpolateOnDomain(Da Line 496  void MeshAdapter::interpolateOnDomain(Da
496          if (target.getFunctionSpace().getTypeCode()==Elements) {          if (target.getFunctionSpace().getTypeCode()==Elements) {
497             Finley_Assemble_CopyElementData(mesh->Elements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Elements,&(target.getDataC()),&(in.getDataC()));
498          } else {          } else {
499             Finley_ErrorCode=TYPE_ERROR;             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");
            sprintf(Finley_ErrorMsg,"No interpolation with data on elements possible.");  
500          }          }
501          break;          break;
502       case(FaceElements):       case(FaceElements):
503          if (target.getFunctionSpace().getTypeCode()==FaceElements) {          if (target.getFunctionSpace().getTypeCode()==FaceElements) {
504             Finley_Assemble_CopyElementData(mesh->FaceElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->FaceElements,&(target.getDataC()),&(in.getDataC()));
505          } else {          } else {
506             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.");  
507             break;             break;
508         }         }
509       case(Points):       case(Points):
510          if (target.getFunctionSpace().getTypeCode()==Points) {          if (target.getFunctionSpace().getTypeCode()==Points) {
511             Finley_Assemble_CopyElementData(mesh->Points,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Points,&(target.getDataC()),&(in.getDataC()));
512          } else {          } else {
513             Finley_ErrorCode=TYPE_ERROR;             throw FinleyAdapterException("Error - No interpolation with data on points possible.");
            sprintf(Finley_ErrorMsg,"No interpolation with data on points possible.");  
514             break;             break;
515          }          }
516          break;          break;
# Line 524  void MeshAdapter::interpolateOnDomain(Da Line 519  void MeshAdapter::interpolateOnDomain(Da
519          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {
520             Finley_Assemble_CopyElementData(mesh->ContactElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->ContactElements,&(target.getDataC()),&(in.getDataC()));
521          } else {          } else {
522             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.");  
523             break;             break;
524          }          }
525          break;          break;
# Line 550  void MeshAdapter::interpolateOnDomain(Da Line 544  void MeshAdapter::interpolateOnDomain(Da
544                Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));                Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));
545               break;               break;
546             default:             default:
547               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
548               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();
549                 throw FinleyAdapterException(temp.str());
550               break;               break;
551          }          }
552          break;          break;
# Line 574  void MeshAdapter::interpolateOnDomain(Da Line 569  void MeshAdapter::interpolateOnDomain(Da
569               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));
570               break;               break;
571            case(Nodes):            case(Nodes):
572               Finley_ErrorCode=TYPE_ERROR;               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");
              sprintf(Finley_ErrorMsg,"Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");  
573               break;               break;
574            case(DegreesOfFreedom):            case(DegreesOfFreedom):
575               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");  
576               break;               break;
577            default:            default:
578               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
579               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();
580                 throw FinleyAdapterException(temp.str());
581               break;               break;
582         }         }
583         break;         break;
584       default:       default:
585          Finley_ErrorCode=TYPE_ERROR;          stringstream temp;
586          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();
587            throw FinleyAdapterException(temp.str());
588          break;          break;
589    }    }
590    checkFinleyError();    checkFinleyError();
# Line 627  void MeshAdapter::setToNormal(Data& norm Line 622  void MeshAdapter::setToNormal(Data& norm
622    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
623    switch(normal.getFunctionSpace().getTypeCode()) {    switch(normal.getFunctionSpace().getTypeCode()) {
624      case(Nodes):      case(Nodes):
625        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");  
626        break;        break;
627      case(Elements):      case(Elements):
628        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");  
629        break;        break;
630      case (FaceElements):      case (FaceElements):
631        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&(normal.getDataC()));
632        break;        break;
633      case(Points):      case(Points):
634        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");  
635        break;        break;
636      case (ContactElementsOne):      case (ContactElementsOne):
637      case (ContactElementsZero):      case (ContactElementsZero):
638        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&(normal.getDataC()));
639        break;        break;
640      case(DegreesOfFreedom):      case(DegreesOfFreedom):
641        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.");  
642        break;        break;
643      case(ReducedDegreesOfFreedom):      case(ReducedDegreesOfFreedom):
644        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.");  
645        break;        break;
646      default:      default:
647        Finley_ErrorCode=TYPE_ERROR;        stringstream temp;
648        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();
649          throw FinleyAdapterException(temp.str());
650        break;        break;
651    }    }
652    checkFinleyError();    checkFinleyError();
# Line 670  void MeshAdapter::interpolateACross(Data Line 661  void MeshAdapter::interpolateACross(Data
661    if (targetDomain!=*this)    if (targetDomain!=*this)
662       throw FinleyAdapterException("Error - Illegal domain of interpolation target");       throw FinleyAdapterException("Error - Illegal domain of interpolation target");
663    
664    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();  
665  }  }
666    
667  //  //
# Line 687  void MeshAdapter::setToIntegrals(std::ve Line 676  void MeshAdapter::setToIntegrals(std::ve
676    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
677    switch(arg.getFunctionSpace().getTypeCode()) {    switch(arg.getFunctionSpace().getTypeCode()) {
678       case(Nodes):       case(Nodes):
679          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.");  
680          break;          break;
681       case(Elements):       case(Elements):
682          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&(arg.getDataC()),&integrals[0]);
# Line 697  void MeshAdapter::setToIntegrals(std::ve Line 685  void MeshAdapter::setToIntegrals(std::ve
685          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&(arg.getDataC()),&integrals[0]);
686          break;          break;
687       case(Points):       case(Points):
688          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.");  
689          break;          break;
690       case(ContactElementsZero):       case(ContactElementsZero):
691          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);
# Line 707  void MeshAdapter::setToIntegrals(std::ve Line 694  void MeshAdapter::setToIntegrals(std::ve
694          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);
695          break;          break;
696       case(DegreesOfFreedom):       case(DegreesOfFreedom):
697          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.");  
698          break;          break;
699       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
700          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.");  
701          break;          break;
702       default:       default:
703          Finley_ErrorCode=TYPE_ERROR;          stringstream temp;
704          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();
705            throw FinleyAdapterException(temp.str());
706          break;          break;
707    }    }
708    checkFinleyError();    checkFinleyError();
# Line 737  void MeshAdapter::setToGradient(Data& gr Line 723  void MeshAdapter::setToGradient(Data& gr
723    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
724    switch(grad.getFunctionSpace().getTypeCode()) {    switch(grad.getFunctionSpace().getTypeCode()) {
725         case(Nodes):         case(Nodes):
726            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");
           sprintf(Finley_ErrorMsg,"Gradient at nodes is not supported.");  
727            break;            break;
728         case(Elements):         case(Elements):
729            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&(grad.getDataC()),&(arg.getDataC()));
# Line 747  void MeshAdapter::setToGradient(Data& gr Line 732  void MeshAdapter::setToGradient(Data& gr
732            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&(grad.getDataC()),&(arg.getDataC()));
733            break;            break;
734         case(Points):         case(Points):
735            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Gradient at points is not supported.");
           sprintf(Finley_ErrorMsg,"Gradient at points is not supported.");  
736            break;            break;
737         case(ContactElementsZero):         case(ContactElementsZero):
738            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));
# Line 757  void MeshAdapter::setToGradient(Data& gr Line 741  void MeshAdapter::setToGradient(Data& gr
741            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&(arg.getDataC()));
742            break;            break;
743         case(DegreesOfFreedom):         case(DegreesOfFreedom):
744            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.");  
745            break;            break;
746         case(ReducedDegreesOfFreedom):         case(ReducedDegreesOfFreedom):
747            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.");  
748            break;            break;
749         default:         default:
750            Finley_ErrorCode=TYPE_ERROR;            stringstream temp;
751            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();
752              throw FinleyAdapterException(temp.str());
753            break;            break;
754    }    }
755    checkFinleyError();    checkFinleyError();
# Line 781  void MeshAdapter::setToSize(Data& size) Line 764  void MeshAdapter::setToSize(Data& size)
764    escriptDataC tmp=size.getDataC();    escriptDataC tmp=size.getDataC();
765    switch(size.getFunctionSpace().getTypeCode()) {    switch(size.getFunctionSpace().getTypeCode()) {
766         case(Nodes):         case(Nodes):
767            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Size of nodes is not supported.");
           sprintf(Finley_ErrorMsg,"Size of nodes is not supported.");  
768            break;            break;
769         case(Elements):         case(Elements):
770            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
# Line 791  void MeshAdapter::setToSize(Data& size) Line 773  void MeshAdapter::setToSize(Data& size)
773            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
774            break;            break;
775         case(Points):         case(Points):
776            Finley_ErrorCode=TYPE_ERROR;            throw FinleyAdapterException("Error - Size of point elements is not supported.");
           sprintf(Finley_ErrorMsg,"Size of point elements is not supported.");  
777            break;            break;
778         case(ContactElementsZero):         case(ContactElementsZero):
779         case(ContactElementsOne):         case(ContactElementsOne):
780            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
781            break;            break;
782         case(DegreesOfFreedom):         case(DegreesOfFreedom):
783            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.");  
784            break;            break;
785         case(ReducedDegreesOfFreedom):         case(ReducedDegreesOfFreedom):
786            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.");  
787            break;            break;
788         default:         default:
789            Finley_ErrorCode=TYPE_ERROR;            stringstream temp;
790            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();
791              throw FinleyAdapterException(temp.str());
792            break;            break;
793    }    }
794    checkFinleyError();    checkFinleyError();
# Line 826  void MeshAdapter::setNewX(const Data& ne Line 806  void MeshAdapter::setNewX(const Data& ne
806  }  }
807    
808  // saves a data array in openDX format:  // saves a data array in openDX format:
809  void MeshAdapter::saveDX(const std::string& filename,const Data& arg) const  void MeshAdapter::saveDX(const std::string& filename,const boost::python::dict& arg) const
810  {  {
811    Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));      int MAX_namelength=256;
812    checkFinleyError();      const int num_data=boost::python::extract<int>(arg.attr("__len__")());
813        char names[num_data][MAX_namelength];
814        char* c_names[num_data];
815        escriptDataC data[num_data];
816        escriptDataC* ptr_data[num_data];
817    
818        boost::python::list keys=arg.keys();
819        for (int i=0;i<num_data;++i) {
820             Data& d=boost::python::extract<Data&>(arg[keys[i]]);
821             if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
822                 throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
823             data[i]=d.getDataC();
824             ptr_data[i]=&(data[i]);
825             std::string n=boost::python::extract<std::string>(keys[i]);
826             c_names[i]=&(names[i][0]);
827             if (n.length()>MAX_namelength-1) {
828                strncpy(c_names[i],n.c_str(),MAX_namelength-1);
829                c_names[i][MAX_namelength-1]='\0';
830             } else {
831                strcpy(c_names[i],n.c_str());
832             }
833        }
834        Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);
835        checkFinleyError();
836        return;
837  }  }
838    
839  // saves a data array in openVTK format:  // saves a data array in openVTK format:
840  void MeshAdapter::saveVTK(const std::string& filename,const Data& arg) const  void MeshAdapter::saveVTK(const std::string& filename,const boost::python::dict& arg) const
841  {  {
842    Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));      int MAX_namelength=256;
843    checkFinleyError();      const int num_data=boost::python::extract<int>(arg.attr("__len__")());
844        char names[num_data][MAX_namelength];
845        char* c_names[num_data];
846        escriptDataC data[num_data];
847        escriptDataC* ptr_data[num_data];
848    
849        boost::python::list keys=arg.keys();
850        for (int i=0;i<num_data;++i) {
851             Data& d=boost::python::extract<Data&>(arg[keys[i]]);
852             if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
853                 throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
854             data[i]=d.getDataC();
855             ptr_data[i]=&(data[i]);
856             std::string n=boost::python::extract<std::string>(keys[i]);
857             c_names[i]=&(names[i][0]);
858             if (n.length()>MAX_namelength-1) {
859                strncpy(c_names[i],n.c_str(),MAX_namelength-1);
860                c_names[i][MAX_namelength-1]='\0';
861             } else {
862                strcpy(c_names[i],n.c_str());
863             }
864        }
865        Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);
866        checkFinleyError();
867        return;
868  }  }
869                                                                                                                                                                            
870                                                                                                                                                                            
871  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
872  SystemMatrixAdapter MeshAdapter::newSystemMatrix(  SystemMatrixAdapter MeshAdapter::newSystemMatrix(
873                        const int row_blocksize,                        const int row_blocksize,
# Line 873  SystemMatrixAdapter MeshAdapter::newSyst Line 902  SystemMatrixAdapter MeshAdapter::newSyst
902      }      }
903      // generate matrix:      // generate matrix:
904            
905      Finley_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);
906      checkFinleyError();      checkFinleyError();
907      Finley_SystemMatrix* fsystemMatrix=Finley_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);      Paso_SystemMatrix* fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);
908      checkFinleyError();      checkPasoError();
909      Finley_SystemMatrixPattern_dealloc(fsystemMatrixPattern);      Paso_SystemMatrixPattern_dealloc(fsystemMatrixPattern);
910      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
911  }  }
912    
# Line 904  bool MeshAdapter::isCellOriented(int fun Line 933  bool MeshAdapter::isCellOriented(int fun
933            return true;            return true;
934            break;            break;
935         default:         default:
936            Finley_ErrorCode=TYPE_ERROR;            stringstream temp;
937            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;
938              throw FinleyAdapterException(temp.str());
939            break;            break;
940    }    }
941    checkFinleyError();    checkFinleyError();
# Line 927  bool MeshAdapter::probeInterpolationOnDo Line 957  bool MeshAdapter::probeInterpolationOnDo
957             case(ContactElementsOne):             case(ContactElementsOne):
958                 return true;                 return true;
959             default:             default:
960                 Finley_ErrorCode=TYPE_ERROR;                 stringstream temp;
961                 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;
962                   throw FinleyAdapterException(temp.str());
963          }          }
964          break;          break;
965       case(Elements):       case(Elements):
# Line 968  bool MeshAdapter::probeInterpolationOnDo Line 999  bool MeshAdapter::probeInterpolationOnDo
999             case(ContactElementsOne):             case(ContactElementsOne):
1000                return true;                return true;
1001             default:             default:
1002               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
1003               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;
1004                 throw FinleyAdapterException(temp.str());
1005          }          }
1006          break;          break;
1007       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
# Line 985  bool MeshAdapter::probeInterpolationOnDo Line 1017  bool MeshAdapter::probeInterpolationOnDo
1017            case(DegreesOfFreedom):            case(DegreesOfFreedom):
1018               return false;               return false;
1019            default:            default:
1020               Finley_ErrorCode=TYPE_ERROR;               stringstream temp;
1021               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;
1022                 throw FinleyAdapterException(temp.str());
1023         }         }
1024         break;         break;
1025       default:       default:
1026          Finley_ErrorCode=TYPE_ERROR;          stringstream temp;
1027          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;
1028            throw FinleyAdapterException(temp.str());
1029          break;          break;
1030    }    }
1031    checkFinleyError();    checkFinleyError();
# Line 1018  bool MeshAdapter::operator!=(const Abstr Line 1052  bool MeshAdapter::operator!=(const Abstr
1052    return !(operator==(other));    return !(operator==(other));
1053  }  }
1054    
1055  int MeshAdapter::getSystemMatrixTypeId(const int solver, const bool symmetry) const  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int package, const bool symmetry) const
1056  {  {
1057     int out=Finley_SystemMatrix_getSystemMatrixTypeId(solver,symmetry?1:0);     int out=Paso_SystemMatrix_getSystemMatrixTypeId(SystemMatrixAdapter::mapOptionToPaso(solver),SystemMatrixAdapter::mapOptionToPaso(package),symmetry?1:0);
1058     checkFinleyError();     checkPasoError();
1059     return out;     return out;
1060  }  }
1061    

Legend:
Removed from v.149  
changed lines
  Added in v.201

  ViewVC Help
Powered by ViewVC 1.1.26