/[escript]/branches/domexper/dudley/src/CPPAdapter/dudleycpp.cpp
ViewVC logotype

Diff of /branches/domexper/dudley/src/CPPAdapter/dudleycpp.cpp

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

revision 1062 by gross, Mon Mar 26 06:17:53 2007 UTC revision 1800 by ksteube, Thu Sep 18 05:28:20 2008 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /* $Id$ */
3   ******************************************************************************  
4   *                                                                            *  /*******************************************************
5   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *   *
6   *                                                                            *   *           Copyright 2003-2007 by ACceSS MNRF
7   * This software is the property of ACcESS.  No part of this code             *   *       Copyright 2007 by University of Queensland
8   * may be copied in any form or by any means without the expressed written    *   *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *                http://esscc.uq.edu.au
10   * by any unauthorised person is illegal unless that                          *   *        Primary Business: Queensland, Australia
11   * person has a software license agreement with ACcESS.                       *   *  Licensed under the Open Software License version 3.0
12   *                                                                            *   *     http://www.opensource.org/licenses/osl-3.0.php
13   ******************************************************************************   *
14     *******************************************************/
 ******************************************************************************/  
15    
16  #ifdef PASO_MPI  #ifdef PASO_MPI
17  #include <mpi.h>  #include <mpi.h>
18    #include "paso/Paso_MPI.h"
19  #endif  #endif
20  extern "C" {  extern "C" {
21  #include "../Finley.h"  #include "../Finley.h"
# Line 24  extern "C" { Line 24  extern "C" {
24  #include "MeshAdapter.h"  #include "MeshAdapter.h"
25  #include "MeshAdapterFactory.h"  #include "MeshAdapterFactory.h"
26  #include "SystemMatrixAdapter.h"  #include "SystemMatrixAdapter.h"
27    #include "TransportProblemAdapter.h"
28    
29  #include "FinleyAdapterException.h"  #include "FinleyAdapterException.h"
30  // #include "esysUtils/EsysException.h"  // #include "esysUtils/EsysException.h"
# Line 79  using namespace boost::python; Line 80  using namespace boost::python;
80  BOOST_PYTHON_MODULE(finleycpp)  BOOST_PYTHON_MODULE(finleycpp)
81  {  {
82    
   // def("ReadMesh",finley::readMesh,readMesh_overloads());  
   // def("Brick",finley::brick,brick_overloads());  
   // def("Rectangle",finley::rectangle,rectangle_overloads());  
   // def("Interval",finley::interval,interval_overloads());  
   // def("GlueFaces",finley::glueFaces,glueFaces_overloads());  
   // def("JoinFaces",finley::joinFaces,joinFaces_overloads());  
83    //    //
84    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
85    // return pointers.    // return pointers.
86      //
87      register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));
88    
89      def("LoadMesh",finley::loadMesh,
90          (arg("fileName")="file.nc"),
91          return_value_policy<manage_new_object>());
92    def("ReadMesh",finley::readMesh,    def("ReadMesh",finley::readMesh,
93        (arg("fileName"),arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  arg("optimizeLabeling")=true),        (arg("fileName")="file.fly",arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  arg("optimize")=true),
94          return_value_policy<manage_new_object>());
95      def("ReadMeshMPI",finley::readMeshMPI,
96          (arg("fileName")="file.fly",arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  arg("optimize")=true),
97        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
98    
99    def("ReadGmsh",finley::readGmsh,    def("ReadGmsh",finley::readGmsh,
100        (arg("fileName"),arg("numDim"), arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimizeLabeling")=true),        (arg("fileName")="file.msh",arg("numDim"), arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimize")=true),
101        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
102    
103    def ("Brick",finley::brick,    def ("Brick",finley::brick,
# Line 103  BOOST_PYTHON_MODULE(finleycpp) Line 106  BOOST_PYTHON_MODULE(finleycpp)
106        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
107        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,
108        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
109        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
110          arg("useFullElementOrder")=false,
111          arg("optimize")=false),
112        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
113    
114    def ("Rectangle",finley::rectangle,    def ("Rectangle",finley::rectangle,
# Line 111  BOOST_PYTHON_MODULE(finleycpp) Line 116  BOOST_PYTHON_MODULE(finleycpp)
116        arg("l0")=1.0,arg("l1")=1.0,        arg("l0")=1.0,arg("l1")=1.0,
117        arg("periodic0")=false,arg("periodic1")=false,        arg("periodic0")=false,arg("periodic1")=false,
118        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
119        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
120        return_value_policy<manage_new_object>());        arg("useFullElementOrder")=false,
121          arg("optimize")=false),
   def("Interval",finley::interval,  
       (arg("n1")=1,arg("order")=1,  
       arg("l1")=1.0,arg("periodic0")=false,  
       arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  
       arg("useElementsOnFace")=false),  
122        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
123    
124    def("Merge",finley::meshMerge,    def("Merge",finley::meshMerge,
# Line 127  BOOST_PYTHON_MODULE(finleycpp) Line 127  BOOST_PYTHON_MODULE(finleycpp)
127    def("GlueFaces",finley::glueFaces,    def("GlueFaces",finley::glueFaces,
128        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
129        arg("tolerance")=1.e-8,        arg("tolerance")=1.e-8,
130        arg("optimizeLabeling")=true),        arg("optimize")=true),
131        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
132    
133    def("JoinFaces",finley::joinFaces,    def("JoinFaces",finley::joinFaces,
134        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
135        arg("tolerance")=1.e-8,        arg("tolerance")=1.e-8,
136        arg("optimizeLabeling")=true),        arg("optimize")=true),
137        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
138    
139    register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));  
140    
141    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
142        ("MeshAdapter",init<optional <Finley_Mesh*> >())        ("MeshAdapter",init<optional <Finley_Mesh*> >())
143        .def(init<const finley::MeshAdapter&>())        .def(init<const finley::MeshAdapter&>())
144        .def("write",&finley::MeshAdapter::write)        .def("write",&finley::MeshAdapter::write)
145          .def("print_mesh_info",&finley::MeshAdapter::Print_Mesh_Info,(arg("full")=false))
146          .def("dump",&finley::MeshAdapter::dump)
147        .def("getDescription",&finley::MeshAdapter::getDescription)        .def("getDescription",&finley::MeshAdapter::getDescription)
148        .def("getDim",&finley::MeshAdapter::getDim)        .def("getDim",&finley::MeshAdapter::getDim)
149        .def("getDataShape",&finley::MeshAdapter::getDataShape)        .def("getDataShape",&finley::MeshAdapter::getDataShape)
150          .def("getNumDataPointsGlobal",&finley::MeshAdapter::getNumDataPointsGlobal)
151        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)
152          .def("addPDEToLumpedSystem",&finley::MeshAdapter::addPDEToLumpedSystem)
153        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)
154          .def("addPDEToTransportProblem",&finley::MeshAdapter::addPDEToTransportProblem)
155        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)
156          .def("newTransportProblem",&finley::MeshAdapter::newTransportProblem)
157        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)
158        .def("setX",&finley::MeshAdapter::setNewX)        .def("setX",&finley::MeshAdapter::setNewX)
159        .def("getX",&finley::MeshAdapter::getX)        .def("getX",&finley::MeshAdapter::getX)
# Line 158  BOOST_PYTHON_MODULE(finleycpp) Line 164  BOOST_PYTHON_MODULE(finleycpp)
164        .def("setTagMap",&finley::MeshAdapter::setTagMap)        .def("setTagMap",&finley::MeshAdapter::setTagMap)
165        .def("getTag",&finley::MeshAdapter::getTag)        .def("getTag",&finley::MeshAdapter::getTag)
166        .def("isValidTagName",&finley::MeshAdapter::isValidTagName)        .def("isValidTagName",&finley::MeshAdapter::isValidTagName)
167        .def("showTagNames",&finley::MeshAdapter::showTagNames);        .def("showTagNames",&finley::MeshAdapter::showTagNames)
168          .def("getMPISize",&finley::MeshAdapter::getMPISize)
169          .def("getMPIRank",&finley::MeshAdapter::getMPIRank)
170          .def("getMPIComm",&finley::MeshAdapter::getMPIComm);
171    
172    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >
173        ("OperatorAdapter",no_init)        ("OperatorAdapter",no_init)
174          .def("print_matrix_info",&finley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false))
175        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)
176        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)
177        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)
178        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);
179    
180      class_<finley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >
181          ("TransportProblemAdapter",no_init)
182          .def("getSafeTimeStepSize",&finley::TransportProblemAdapter::getSafeTimeStepSize)
183          .def("resetTransport",&finley::TransportProblemAdapter::resetTransport);
184  }  }

Legend:
Removed from v.1062  
changed lines
  Added in v.1800

  ViewVC Help
Powered by ViewVC 1.1.26