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

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

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

revision 3675 by jfenwick, Thu Nov 17 00:53:38 2011 UTC revision 3981 by jfenwick, Fri Sep 21 02:47:54 2012 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2010 by University of Queensland  * Copyright (c) 2003-2012 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * http://www.uq.edu.au
 * http://www.uq.edu.au/esscc  
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
8  * Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
9  * http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
10  *  *
11  *******************************************************/  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12    * Development since 2012 by School of Earth Sciences
13    *
14    *****************************************************************************/
15    
16  #include <pasowrap/PasoException.h>  #include <pasowrap/PasoException.h>
17  #include <pasowrap/TransportProblemAdapter.h>  #include <pasowrap/TransportProblemAdapter.h>
# Line 779  void MeshAdapter::addPDEToSystem( Line 781  void MeshAdapter::addPDEToSystem(
781     SystemMatrixAdapter* smat=dynamic_cast<SystemMatrixAdapter*>(&mat);     SystemMatrixAdapter* smat=dynamic_cast<SystemMatrixAdapter*>(&mat);
782     if (smat==0)     if (smat==0)
783     {     {
784      throw FinleyAdapterException("finley only supports its own system matrices.");      throw FinleyAdapterException("finley only supports Paso system matrices.");
785     }     }
786     escriptDataC _rhs=rhs.getDataC();     escriptDataC _rhs=rhs.getDataC();
787     escriptDataC _A  =A.getDataC();     escriptDataC _A  =A.getDataC();
# Line 874  void MeshAdapter::addPDEToTransportProbl Line 876  void MeshAdapter::addPDEToTransportProbl
876                                             const escript::Data& d_contact,const escript::Data& y_contact,                                             const escript::Data& d_contact,const escript::Data& y_contact,
877                                             const escript::Data& d_dirac, const escript::Data& y_dirac) const                                             const escript::Data& d_dirac, const escript::Data& y_dirac) const
878  {  {
879     paso::TransportProblemAdapter* tpa=dynamic_cast<paso::TransportProblemAdapter*>(&tp);     TransportProblemAdapter* tpa=dynamic_cast<TransportProblemAdapter*>(&tp);
880     if (tpa==0)     if (tpa==0)
881     {     {
882      throw FinleyAdapterException("finley only supports its own transport problems.");      throw FinleyAdapterException("finley only supports Paso transport problems.");
883     }     }
884    
885    
# Line 1512  void MeshAdapter::setNewX(const escript: Line 1514  void MeshAdapter::setNewX(const escript:
1514         tmp = new_x.getDataC();         tmp = new_x.getDataC();
1515         Finley_Mesh_setCoordinates(mesh,&tmp);         Finley_Mesh_setCoordinates(mesh,&tmp);
1516     } else {     } else {
1517         escript::Data new_x_inter=escript::Data( new_x,  continuousFunction(*this) );         throw FinleyAdapterException("As of version escript3.3 - SetNewX only accepts ContinuousFunction arguments please interpolate.");    
1518    /*       escript::Data new_x_inter=escript::Data( new_x,  continuousFunction(*this) );
1519         tmp = new_x_inter.getDataC();         tmp = new_x_inter.getDataC();
1520         Finley_Mesh_setCoordinates(mesh,&tmp);         Finley_Mesh_setCoordinates(mesh,&tmp);*/
1521     }     }
1522     checkFinleyError();     checkFinleyError();
1523  }  }
# Line 1665  ASM_ptr MeshAdapter::newSystemMatrix( Line 1668  ASM_ptr MeshAdapter::newSystemMatrix(
1668  // creates a TransportProblemAdapter  // creates a TransportProblemAdapter
1669  //  //
1670  ATP_ptr MeshAdapter::newTransportProblem(  ATP_ptr MeshAdapter::newTransportProblem(
                                                          const bool useBackwardEuler,  
1671                                                           const int blocksize,                                                           const int blocksize,
1672                                                           const escript::FunctionSpace& functionspace,                                                           const escript::FunctionSpace& functionspace,
1673                                                           const int type) const                                                           const int type) const
# Line 1688  ATP_ptr MeshAdapter::newTransportProblem Line 1690  ATP_ptr MeshAdapter::newTransportProblem
1690     Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceOrder,reduceOrder);     Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceOrder,reduceOrder);
1691     checkFinleyError();     checkFinleyError();
1692     Paso_TransportProblem* transportProblem;     Paso_TransportProblem* transportProblem;
1693     transportProblem=Paso_TransportProblem_alloc(useBackwardEuler,fsystemMatrixPattern,blocksize);     transportProblem=Paso_TransportProblem_alloc(fsystemMatrixPattern,blocksize);
1694     checkPasoError();     checkPasoError();
1695     Paso_SystemMatrixPattern_free(fsystemMatrixPattern);     Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1696     TransportProblemAdapter* tpa=new TransportProblemAdapter(transportProblem,useBackwardEuler,blocksize,functionspace);     TransportProblemAdapter* tpa=new TransportProblemAdapter(transportProblem,blocksize,functionspace);
1697     return ATP_ptr(tpa);     return ATP_ptr(tpa);
1698  //   return TransportProblemAdapter(transportProblem,useBackwardEuler,blocksize,functionspace);  //   return TransportProblemAdapter(transportProblem, blocksize,functionspace);
1699  }  }
1700    
1701  //  //
# Line 2052  bool MeshAdapter::operator!=(const Abstr Line 2054  bool MeshAdapter::operator!=(const Abstr
2054  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const
2055  {  {
2056     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2057     int out=Paso_SystemMatrix_getSystemMatrixTypeId(SystemMatrixAdapter::mapOptionToPaso(solver),SystemMatrixAdapter::mapOptionToPaso(preconditioner), SystemMatrixAdapter::mapOptionToPaso(package),symmetry?1:0, mesh->MPIInfo);     return SystemMatrixAdapter::getSystemMatrixTypeId(solver, preconditioner,
2058     checkPasoError();             package, symmetry, mesh->MPIInfo);
    return out;  
2059  }  }
2060    
2061  int MeshAdapter::getTransportTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const  int MeshAdapter::getTransportTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const
2062  {  {
2063     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2064     int out=Paso_TransportProblem_getTypeId(SystemMatrixAdapter::mapOptionToPaso(solver),SystemMatrixAdapter::mapOptionToPaso(preconditioner), SystemMatrixAdapter::mapOptionToPaso(package),symmetry?1:0, mesh->MPIInfo);     return TransportProblemAdapter::getTransportTypeId(solver, preconditioner,
2065     checkPasoError();             package, symmetry, mesh->MPIInfo);
    return out;  
2066  }  }
2067    
2068  escript::Data MeshAdapter::getX() const  escript::Data MeshAdapter::getX() const
# Line 2242  void MeshAdapter::setTagMap(const string Line 2243  void MeshAdapter::setTagMap(const string
2243  {  {
2244     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2245     Finley_Mesh_addTagMap(mesh, name.c_str(),tag);     Finley_Mesh_addTagMap(mesh, name.c_str(),tag);
2246     checkPasoError();     checkFinleyError();
2247     // throwStandardException("MeshAdapter::set TagMap is not implemented.");     // throwStandardException("MeshAdapter::set TagMap is not implemented.");
2248  }  }
2249    
# Line 2251  int MeshAdapter::getTag(const string& na Line 2252  int MeshAdapter::getTag(const string& na
2252     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2253     int tag=0;     int tag=0;
2254     tag=Finley_Mesh_getTag(mesh, name.c_str());     tag=Finley_Mesh_getTag(mesh, name.c_str());
2255     checkPasoError();     checkFinleyError();
2256     // throwStandardException("MeshAdapter::getTag is not implemented.");     // throwStandardException("MeshAdapter::getTag is not implemented.");
2257     return tag;     return tag;
2258  }  }
# Line 2466  void MeshAdapter:: addDiracPoints(const Line 2467  void MeshAdapter:: addDiracPoints(const
2467        }        }
2468                
2469        Finley_Mesh_addPoints(mesh, numPoints, points_ptr, tags_ptr);        Finley_Mesh_addPoints(mesh, numPoints, points_ptr, tags_ptr);
2470        checkPasoError();        checkFinleyError();
2471                
2472        TMPMEMFREE(points_ptr);        TMPMEMFREE(points_ptr);
2473        TMPMEMFREE(tags_ptr);        TMPMEMFREE(tags_ptr);

Legend:
Removed from v.3675  
changed lines
  Added in v.3981

  ViewVC Help
Powered by ViewVC 1.1.26