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

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

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

trunk/esys2/finley/src/CPPAdapter/finleycpp.cpp revision 121 by jgs, Fri May 6 04:26:16 2005 UTC trunk/finley/src/CPPAdapter/finleycpp.cpp revision 2061 by jfenwick, Wed Nov 19 03:40:21 2008 UTC
# Line 1  Line 1 
 // $Id$  
 /*  
  ******************************************************************************  
  *                                                                            *  
  *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *  
  *                                                                            *  
  * This software is the property of ACcESS.  No part of this code             *  
  * may be copied in any form or by any means without the expressed written    *  
  * consent of ACcESS.  Copying, use or modification of this software          *  
  * by any unauthorised person is illegal unless that                          *  
  * person has a software license agreement with ACcESS.                       *  
  *                                                                            *  
  ******************************************************************************  
   
 ******************************************************************************/  
1    
2    /*******************************************************
3    *
4    * Copyright (c) 2003-2008 by University of Queensland
5    * Earth Systems Science Computational Center (ESSCC)
6    * http://www.uq.edu.au/esscc
7    *
8    * Primary Business: Queensland, Australia
9    * Licensed under the Open Software License version 3.0
10    * http://www.opensource.org/licenses/osl-3.0.php
11    *
12    *******************************************************/
13    
14    
15    #ifdef PASO_MPI
16    #include <mpi.h>
17    #include "paso/Paso_MPI.h"
18    #endif
19  extern "C" {  extern "C" {
20  #include "finley/finleyC/Finley.h"  #include "../Finley.h"
21  }  }
 #include "finley/CPPAdapter/MeshAdapter.h"  
 #include "finley/CPPAdapter/MeshAdapterFactory.h"  
 #include "finley/CPPAdapter/SystemMatrixAdapter.h"  
22    
23  #include "esysUtils/EsysException.h"  #include "MeshAdapter.h"
24    #include "MeshAdapterFactory.h"
25    #include "SystemMatrixAdapter.h"
26    #include "TransportProblemAdapter.h"
27    
28    #include "FinleyAdapterException.h"
29    // #include "esysUtils/EsysException.h"
30  #include "esysUtils/esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
31    
32  #include "escript/Data/AbstractContinuousDomain.h"  #include "escript/AbstractContinuousDomain.h"
33    
34  #include <boost/python.hpp>  #include <boost/python.hpp>
35  #include <boost/python/module.hpp>  #include <boost/python/module.hpp>
# Line 73  using namespace boost::python; Line 78  using namespace boost::python;
78    
79  BOOST_PYTHON_MODULE(finleycpp)  BOOST_PYTHON_MODULE(finleycpp)
80  {  {
81      // params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures
82      docstring_options docopt(true, true, false);
83    
   // 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());  
84    //    //
85    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
86    // return pointers.    // return pointers.
87      //
88      register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));
89    
90      def("LoadMesh",finley::loadMesh,
91          (arg("fileName")="file.nc")
92    /*      ,return_value_policy<manage_new_object>());*/
93          );
94    
95    def("ReadMesh",finley::readMesh,    def("ReadMesh",finley::readMesh,
96        (arg("fileName"),arg("integrationOrder")=-1),        (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    
100      def("ReadGmsh",finley::readGmsh,
101          (arg("fileName")="file.msh",arg("numDim"), arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimize")=true)
102    //       ,return_value_policy<manage_new_object>());
103        );
104    
105    def ("Brick",finley::brick,    def ("Brick",finley::brick,
106        (arg("n0")=1,arg("n1")=1,arg("n2")=1,        (arg("n0")=1,arg("n1")=1,arg("n2")=1,
107        arg("order")=1,        arg("order")=1,
108        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
109        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,
110        arg("integrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
111        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
112        return_value_policy<manage_new_object>());        arg("useFullElementOrder")=false,
113          arg("optimize")=false)
114    //       ,return_value_policy<manage_new_object>());
115        );
116    
117    def ("Rectangle",finley::rectangle,    def ("Rectangle",finley::rectangle,
118        (arg("n0")=1,arg("n1")=1,arg("order")=1,        (arg("n0")=1,arg("n1")=1,arg("order")=1,
119        arg("l0")=1.0,arg("l1")=1.0,        arg("l0")=1.0,arg("l1")=1.0,
120        arg("periodic0")=false,arg("periodic1")=false,        arg("periodic0")=false,arg("periodic1")=false,
121        arg("integrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
122        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
123        return_value_policy<manage_new_object>());        arg("useFullElementOrder")=false,
124          arg("optimize")=false)
125    def("Interval",finley::interval,  //       ,return_value_policy<manage_new_object>());
126        (arg("n1")=1,arg("order")=1,      );
127        arg("l1")=1.0,arg("periodic0")=false,  
128        arg("integrationOrder")=-1,    def("Merge",finley::meshMerge
129        arg("useElementsOnFace")=false),  //       ,return_value_policy<manage_new_object>());
130        return_value_policy<manage_new_object>());    );
   
   def("Merge",finley::meshMerge,  
       return_value_policy<manage_new_object>());  
131    
132    def("GlueFaces",finley::glueFaces,    def("GlueFaces",finley::glueFaces,
133        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
134        arg("tolerance")=std::numeric_limits<double>::epsilon()),        arg("tolerance")=1.e-8,
135        return_value_policy<manage_new_object>());        arg("optimize")=true)
136    //       ,return_value_policy<manage_new_object>());
137        );
138    
139    def("JoinFaces",finley::joinFaces,    def("JoinFaces",finley::joinFaces,
140        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
141        arg("tolerance")=std::numeric_limits<double>::epsilon()),        arg("tolerance")=1.e-8,
142        return_value_policy<manage_new_object>());        arg("optimize")=true)
143    //       ,return_value_policy<manage_new_object>());
144        );
145    
   register_exception_translator<esysUtils::EsysException>(&esysUtils::esysExceptionTranslator);  
146    
147    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
148        ("MeshAdapter",init<optional <Finley_Mesh*> >())        ("MeshAdapter","A concrete class representing a domain. For more details, please consult the c++ documentation.",init<optional <Finley_Mesh*> >())
149        .def(init<const finley::MeshAdapter&>())        .def(init<const finley::MeshAdapter&>())
150        .def("write",&finley::MeshAdapter::write)        .def("write",&finley::MeshAdapter::write)
151          .def("print_mesh_info",&finley::MeshAdapter::Print_Mesh_Info,(arg("full")=false))
152          .def("dump",&finley::MeshAdapter::dump)
153        .def("getDescription",&finley::MeshAdapter::getDescription)        .def("getDescription",&finley::MeshAdapter::getDescription)
154        .def("getDim",&finley::MeshAdapter::getDim)        .def("getDim",&finley::MeshAdapter::getDim)
155        .def("getDataShape",&finley::MeshAdapter::getDataShape)        .def("getDataShape",&finley::MeshAdapter::getDataShape)
156          .def("getNumDataPointsGlobal",&finley::MeshAdapter::getNumDataPointsGlobal)
157        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)
158          .def("addPDEToLumpedSystem",&finley::MeshAdapter::addPDEToLumpedSystem)
159        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)
160          .def("addPDEToTransportProblem",&finley::MeshAdapter::addPDEToTransportProblem)
161        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)
162          .def("newTransportProblem",&finley::MeshAdapter::newTransportProblem)
163        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)
164          .def("getTransportTypeId",&finley::MeshAdapter::getTransportTypeId)
165        .def("setX",&finley::MeshAdapter::setNewX)        .def("setX",&finley::MeshAdapter::setNewX)
166        .def("getX",&finley::MeshAdapter::getX)        .def("getX",&finley::MeshAdapter::getX)
167        .def("getNormal",&finley::MeshAdapter::getNormal)        .def("getNormal",&finley::MeshAdapter::getNormal)
168        .def("getSize",&finley::MeshAdapter::getSize);        .def("getSize",&finley::MeshAdapter::getSize)
169          .def("saveDX",&finley::MeshAdapter::saveDX)
170          .def("saveVTK",&finley::MeshAdapter::saveVTK)
171          .def("setTagMap",&finley::MeshAdapter::setTagMap)
172          .def("getTag",&finley::MeshAdapter::getTag)
173          .def("isValidTagName",&finley::MeshAdapter::isValidTagName)
174          .def("showTagNames",&finley::MeshAdapter::showTagNames)
175          .def("getMPISize",&finley::MeshAdapter::getMPISize)
176          .def("getMPIRank",&finley::MeshAdapter::getMPIRank)
177          .def("MPIBarrier",&finley::MeshAdapter::MPIBarrier)
178          .def("onMasterProcessor",&finley::MeshAdapter::onMasterProcessor);
179    
180    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >
181        ("OperatorAdapter",no_init)        ("OperatorAdapter","A concrete class representing an operator. For more details, please see the c++ documentation.", no_init)
182          .def("print_matrix_info",&finley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false))
183        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)
184        .def("setValue",&finley::SystemMatrixAdapter::setValue)        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)
185        .def("resetSolver",&finley::SystemMatrixAdapter::resetSolver)        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)
186        .def("saveMM",&finley::SystemMatrixAdapter::saveMM);        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);
187    
188      class_<finley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >
189          ("TransportProblemAdapter","",no_init)
190          .def("getSafeTimeStepSize",&finley::TransportProblemAdapter::getSafeTimeStepSize)
191          .def("getUnlimitedTimeStepSize",&finley::TransportProblemAdapter::getUnlimitedTimeStepSize)
192          .def("resetTransport",&finley::TransportProblemAdapter::resetTransport);
193  }  }

Legend:
Removed from v.121  
changed lines
  Added in v.2061

  ViewVC Help
Powered by ViewVC 1.1.26