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

Diff of /trunk/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 1370 by gross, Wed Jan 2 09:21:43 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    /* $Id$ */
3    
4    /*******************************************************
5     *
6     *           Copyright 2003-2007 by ACceSS MNRF
7     *       Copyright 2007 by University of Queensland
8     *
9     *                http://esscc.uq.edu.au
10     *        Primary Business: Queensland, Australia
11     *  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
17    #include <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 84  BOOST_PYTHON_MODULE(finleycpp) Line 89  BOOST_PYTHON_MODULE(finleycpp)
89    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
90    // return pointers.    // return pointers.
91    
92      def("LoadMesh",finley::loadMesh,
93          (arg("fileName")="file.nc"),
94          return_value_policy<manage_new_object>());
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>());
98      def("ReadMeshMPI",finley::readMeshMPI,
99          (arg("fileName")="file.fly",arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  arg("optimize")=true),
100          return_value_policy<manage_new_object>());
101    
102      def("ReadGmsh",finley::readGmsh,
103          (arg("fileName")="file.msh",arg("numDim"), arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimize")=true),
104        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
105    
106    def ("Brick",finley::brick,    def ("Brick",finley::brick,
# Line 93  BOOST_PYTHON_MODULE(finleycpp) Line 108  BOOST_PYTHON_MODULE(finleycpp)
108        arg("order")=1,        arg("order")=1,
109        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
110        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,
111        arg("integrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
112        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
113          arg("useFullElementOrder")=false,
114          arg("optimize")=false),
115        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
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),
   def("Interval",finley::interval,  
       (arg("n1")=1,arg("order")=1,  
       arg("l1")=1.0,arg("periodic0")=false,  
       arg("integrationOrder")=-1,  
       arg("useElementsOnFace")=false),  
125        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
126    
127    def("Merge",finley::meshMerge,    def("Merge",finley::meshMerge,
# Line 117  BOOST_PYTHON_MODULE(finleycpp) Line 129  BOOST_PYTHON_MODULE(finleycpp)
129    
130    def("GlueFaces",finley::glueFaces,    def("GlueFaces",finley::glueFaces,
131        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
132        arg("tolerance")=std::numeric_limits<double>::epsilon()),        arg("tolerance")=1.e-8,
133          arg("optimize")=true),
134        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
135    
136    def("JoinFaces",finley::joinFaces,    def("JoinFaces",finley::joinFaces,
137        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
138        arg("tolerance")=std::numeric_limits<double>::epsilon()),        arg("tolerance")=1.e-8,
139          arg("optimize")=true),
140        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
141    
142    register_exception_translator<esysUtils::EsysException>(&esysUtils::esysExceptionTranslator);  
143    
144    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
145        ("MeshAdapter",init<optional <Finley_Mesh*> >())        ("MeshAdapter",init<optional <Finley_Mesh*> >())
146        .def(init<const finley::MeshAdapter&>())        .def(init<const finley::MeshAdapter&>())
147        .def("write",&finley::MeshAdapter::write)        .def("write",&finley::MeshAdapter::write)
148          .def("print_mesh_info",&finley::MeshAdapter::Print_Mesh_Info,(arg("full")=false))
149          .def("dump",&finley::MeshAdapter::dump)
150        .def("getDescription",&finley::MeshAdapter::getDescription)        .def("getDescription",&finley::MeshAdapter::getDescription)
151        .def("getDim",&finley::MeshAdapter::getDim)        .def("getDim",&finley::MeshAdapter::getDim)
152        .def("getDataShape",&finley::MeshAdapter::getDataShape)        .def("getDataShape",&finley::MeshAdapter::getDataShape)
153        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)
154          .def("addPDEToLumpedSystem",&finley::MeshAdapter::addPDEToLumpedSystem)
155        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)
156          .def("addPDEToTransportProblem",&finley::MeshAdapter::addPDEToTransportProblem)
157        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)
158          .def("newTransportProblem",&finley::MeshAdapter::newTransportProblem)
159        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)
160        .def("setX",&finley::MeshAdapter::setNewX)        .def("setX",&finley::MeshAdapter::setNewX)
161        .def("getX",&finley::MeshAdapter::getX)        .def("getX",&finley::MeshAdapter::getX)
162        .def("getNormal",&finley::MeshAdapter::getNormal)        .def("getNormal",&finley::MeshAdapter::getNormal)
163        .def("getSize",&finley::MeshAdapter::getSize);        .def("getSize",&finley::MeshAdapter::getSize)
164          .def("saveDX",&finley::MeshAdapter::saveDX)
165          .def("saveVTK",&finley::MeshAdapter::saveVTK)
166          .def("setTagMap",&finley::MeshAdapter::setTagMap)
167          .def("getTag",&finley::MeshAdapter::getTag)
168          .def("isValidTagName",&finley::MeshAdapter::isValidTagName)
169          .def("showTagNames",&finley::MeshAdapter::showTagNames)
170          .def("getMPISize",&finley::MeshAdapter::getMPISize)
171          .def("getMPIRank",&finley::MeshAdapter::getMPIRank);
172    
173    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >
174        ("OperatorAdapter",no_init)        ("OperatorAdapter",no_init)
175          .def("print_matrix_info",&finley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false))
176        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)
177        .def("setValue",&finley::SystemMatrixAdapter::setValue)        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)
178        .def("resetSolver",&finley::SystemMatrixAdapter::resetSolver)        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)
179        .def("saveMM",&finley::SystemMatrixAdapter::saveMM);        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);
180    
181      class_<finley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >
182          ("OperatorAdapter",no_init)
183          .def("resetTransport",&finley::TransportProblemAdapter::resetTransport);
184    
185    
186    
187      register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));
188    
189  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26