/[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

trunk/finley/src/finley/CPPAdapter/finleycpp.cpp revision 201 by jgs, Wed Nov 23 04:10:21 2005 UTC trunk/finley/src/CPPAdapter/finleycpp.cpp revision 1877 by ksteube, Tue Oct 14 02:58:39 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 74  using namespace boost::python; Line 79  using namespace boost::python;
79  BOOST_PYTHON_MODULE(finleycpp)  BOOST_PYTHON_MODULE(finleycpp)
80  {  {
81    
   // 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());  
82    //    //
83    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
84    // return pointers.    // return pointers.
85      //
86      register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));
87    
88      def("LoadMesh",finley::loadMesh,
89          (arg("fileName")="file.nc")
90    /*      ,return_value_policy<manage_new_object>());*/
91          );
92    
93    def("ReadMesh",finley::readMesh,    def("ReadMesh",finley::readMesh,
94        (arg("fileName"),arg("integrationOrder")=-1),        (arg("fileName")="file.fly",arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  arg("optimize")=true)
95        return_value_policy<manage_new_object>());  /*      ,return_value_policy<manage_new_object>());*/
96        );
97    
98      def("ReadGmsh",finley::readGmsh,
99          (arg("fileName")="file.msh",arg("numDim"), arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimize")=true)
100    //       ,return_value_policy<manage_new_object>());
101        );
102    
103    def ("Brick",finley::brick,    def ("Brick",finley::brick,
104        (arg("n0")=1,arg("n1")=1,arg("n2")=1,        (arg("n0")=1,arg("n1")=1,arg("n2")=1,
105        arg("order")=1,        arg("order")=1,
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("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
109        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
110        return_value_policy<manage_new_object>());        arg("useFullElementOrder")=false,
111          arg("optimize")=false)
112    //       ,return_value_policy<manage_new_object>());
113        );
114    
115    def ("Rectangle",finley::rectangle,    def ("Rectangle",finley::rectangle,
116        (arg("n0")=1,arg("n1")=1,arg("order")=1,        (arg("n0")=1,arg("n1")=1,arg("order")=1,
117        arg("l0")=1.0,arg("l1")=1.0,        arg("l0")=1.0,arg("l1")=1.0,
118        arg("periodic0")=false,arg("periodic1")=false,        arg("periodic0")=false,arg("periodic1")=false,
119        arg("integrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
120        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
121        return_value_policy<manage_new_object>());        arg("useFullElementOrder")=false,
122          arg("optimize")=false)
123    def("Interval",finley::interval,  //       ,return_value_policy<manage_new_object>());
124        (arg("n1")=1,arg("order")=1,      );
125        arg("l1")=1.0,arg("periodic0")=false,  
126        arg("integrationOrder")=-1,    def("Merge",finley::meshMerge
127        arg("useElementsOnFace")=false),  //       ,return_value_policy<manage_new_object>());
128        return_value_policy<manage_new_object>());    );
   
   def("Merge",finley::meshMerge,  
       return_value_policy<manage_new_object>());  
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        return_value_policy<manage_new_object>());        arg("optimize")=true)
134    //       ,return_value_policy<manage_new_object>());
135        );
136    
137    def("JoinFaces",finley::joinFaces,    def("JoinFaces",finley::joinFaces,
138        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
139        arg("tolerance")=std::numeric_limits<double>::epsilon()),        arg("tolerance")=1.e-8,
140        return_value_policy<manage_new_object>());        arg("optimize")=true)
141    //       ,return_value_policy<manage_new_object>());
142        );
143    
   register_exception_translator<esysUtils::EsysException>(&esysUtils::esysExceptionTranslator);  
144    
145    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
146        ("MeshAdapter",init<optional <Finley_Mesh*> >())        ("MeshAdapter",init<optional <Finley_Mesh*> >())
147        .def(init<const finley::MeshAdapter&>())        .def(init<const finley::MeshAdapter&>())
148        .def("write",&finley::MeshAdapter::write)        .def("write",&finley::MeshAdapter::write)
149          .def("print_mesh_info",&finley::MeshAdapter::Print_Mesh_Info,(arg("full")=false))
150          .def("dump",&finley::MeshAdapter::dump)
151        .def("getDescription",&finley::MeshAdapter::getDescription)        .def("getDescription",&finley::MeshAdapter::getDescription)
152        .def("getDim",&finley::MeshAdapter::getDim)        .def("getDim",&finley::MeshAdapter::getDim)
153        .def("getDataShape",&finley::MeshAdapter::getDataShape)        .def("getDataShape",&finley::MeshAdapter::getDataShape)
154          .def("getNumDataPointsGlobal",&finley::MeshAdapter::getNumDataPointsGlobal)
155        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)
156          .def("addPDEToLumpedSystem",&finley::MeshAdapter::addPDEToLumpedSystem)
157        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)
158          .def("addPDEToTransportProblem",&finley::MeshAdapter::addPDEToTransportProblem)
159        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)
160          .def("newTransportProblem",&finley::MeshAdapter::newTransportProblem)
161        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)
162          .def("getTransportTypeId",&finley::MeshAdapter::getTransportTypeId)
163        .def("setX",&finley::MeshAdapter::setNewX)        .def("setX",&finley::MeshAdapter::setNewX)
164        .def("getX",&finley::MeshAdapter::getX)        .def("getX",&finley::MeshAdapter::getX)
165        .def("getNormal",&finley::MeshAdapter::getNormal)        .def("getNormal",&finley::MeshAdapter::getNormal)
166        .def("getSize",&finley::MeshAdapter::getSize)        .def("getSize",&finley::MeshAdapter::getSize)
167        .def("saveDX",&finley::MeshAdapter::saveDX)        .def("saveDX",&finley::MeshAdapter::saveDX)
168        .def("saveVTK",&finley::MeshAdapter::saveVTK);        .def("saveVTK",&finley::MeshAdapter::saveVTK)
169          .def("setTagMap",&finley::MeshAdapter::setTagMap)
170          .def("getTag",&finley::MeshAdapter::getTag)
171          .def("isValidTagName",&finley::MeshAdapter::isValidTagName)
172          .def("showTagNames",&finley::MeshAdapter::showTagNames)
173          .def("getMPISize",&finley::MeshAdapter::getMPISize)
174          .def("getMPIRank",&finley::MeshAdapter::getMPIRank)
175          .def("MPIBarrier",&finley::MeshAdapter::MPIBarrier)
176          .def("onMasterProcessor",&finley::MeshAdapter::onMasterProcessor);
177    
178    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >
179        ("OperatorAdapter",no_init)        ("OperatorAdapter",no_init)
180          .def("print_matrix_info",&finley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false))
181        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)
182        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)
183        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)
184        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);
185    
186      class_<finley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >
187          ("TransportProblemAdapter",no_init)
188          .def("getSafeTimeStepSize",&finley::TransportProblemAdapter::getSafeTimeStepSize)
189          .def("getUnlimitedTimeStepSize",&finley::TransportProblemAdapter::getUnlimitedTimeStepSize)
190          .def("resetTransport",&finley::TransportProblemAdapter::resetTransport);
191  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26