/[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 934 by gross, Tue Jan 23 09:52:45 2007 UTC revision 1859 by gross, Wed Oct 8 03:03:37 2008 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /*******************************************************
3   ******************************************************************************  *
4   *                                                                            *  * Copyright (c) 2003-2008 by University of Queensland
5   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *  * Earth Systems Science Computational Center (ESSCC)
6   *                                                                            *  * http://www.uq.edu.au/esscc
7   * This software is the property of ACcESS.  No part of this code             *  *
8   * may be copied in any form or by any means without the expressed written    *  * Primary Business: Queensland, Australia
9   * consent of ACcESS.  Copying, use or modification of this software          *  * Licensed under the Open Software License version 3.0
10   * by any unauthorised person is illegal unless that                          *  * http://www.opensource.org/licenses/osl-3.0.php
11   * person has a software license agreement with ACcESS.                       *  *
12   *                                                                            *  *******************************************************/
13   ******************************************************************************  
   
 ******************************************************************************/  
14    
15  #ifdef PASO_MPI  #ifdef PASO_MPI
16  #include <mpi.h>  #include <mpi.h>
17    #include "paso/Paso_MPI.h"
18  #endif  #endif
19  extern "C" {  extern "C" {
20  #include "../Finley.h"  #include "../Finley.h"
# Line 24  extern "C" { Line 23  extern "C" {
23  #include "MeshAdapter.h"  #include "MeshAdapter.h"
24  #include "MeshAdapterFactory.h"  #include "MeshAdapterFactory.h"
25  #include "SystemMatrixAdapter.h"  #include "SystemMatrixAdapter.h"
26    #include "TransportProblemAdapter.h"
27    
28  #include "FinleyAdapterException.h"  #include "FinleyAdapterException.h"
29  // #include "esysUtils/EsysException.h"  // #include "esysUtils/EsysException.h"
# Line 79  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    def("ReadMesh",finley::readMesh,    def("ReadMesh",finley::readMesh,
92        (arg("fileName"),arg("integrationOrder")=-1),        (arg("fileName")="file.fly",arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,  arg("optimize")=true),
93        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
94    
95    def("ReadGmsh",finley::readGmsh,    def("ReadGmsh",finley::readGmsh,
96        (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),
97        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
98    
99    def ("Brick",finley::brick,    def ("Brick",finley::brick,
# Line 102  BOOST_PYTHON_MODULE(finleycpp) Line 101  BOOST_PYTHON_MODULE(finleycpp)
101        arg("order")=1,        arg("order")=1,
102        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
103        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,        arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,
104        arg("integrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
105        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
106          arg("useFullElementOrder")=false,
107          arg("optimize")=false),
108        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
109    
110    def ("Rectangle",finley::rectangle,    def ("Rectangle",finley::rectangle,
111        (arg("n0")=1,arg("n1")=1,arg("order")=1,        (arg("n0")=1,arg("n1")=1,arg("order")=1,
112        arg("l0")=1.0,arg("l1")=1.0,        arg("l0")=1.0,arg("l1")=1.0,
113        arg("periodic0")=false,arg("periodic1")=false,        arg("periodic0")=false,arg("periodic1")=false,
114        arg("integrationOrder")=-1,        arg("integrationOrder")=-1,  arg("reducedIntegrationOrder")=-1,
115        arg("useElementsOnFace")=false),        arg("useElementsOnFace")=false,
116        return_value_policy<manage_new_object>());        arg("useFullElementOrder")=false,
117          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),  
118        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
119    
120    def("Merge",finley::meshMerge,    def("Merge",finley::meshMerge,
# Line 126  BOOST_PYTHON_MODULE(finleycpp) Line 122  BOOST_PYTHON_MODULE(finleycpp)
122    
123    def("GlueFaces",finley::glueFaces,    def("GlueFaces",finley::glueFaces,
124        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
125        arg("tolerance")=1.e-8),        arg("tolerance")=1.e-8,
126          arg("optimize")=true),
127        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
128    
129    def("JoinFaces",finley::joinFaces,    def("JoinFaces",finley::joinFaces,
130        (arg("safetyFactor")=0.2,        (arg("safetyFactor")=0.2,
131        arg("tolerance")=1.e-8),        arg("tolerance")=1.e-8,
132          arg("optimize")=true),
133        return_value_policy<manage_new_object>());        return_value_policy<manage_new_object>());
134    
135    register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));  
136    
137    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >    class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
138        ("MeshAdapter",init<optional <Finley_Mesh*> >())        ("MeshAdapter",init<optional <Finley_Mesh*> >())
139        .def(init<const finley::MeshAdapter&>())        .def(init<const finley::MeshAdapter&>())
140        .def("write",&finley::MeshAdapter::write)        .def("write",&finley::MeshAdapter::write)
141          .def("print_mesh_info",&finley::MeshAdapter::Print_Mesh_Info,(arg("full")=false))
142          .def("dump",&finley::MeshAdapter::dump)
143        .def("getDescription",&finley::MeshAdapter::getDescription)        .def("getDescription",&finley::MeshAdapter::getDescription)
144        .def("getDim",&finley::MeshAdapter::getDim)        .def("getDim",&finley::MeshAdapter::getDim)
145        .def("getDataShape",&finley::MeshAdapter::getDataShape)        .def("getDataShape",&finley::MeshAdapter::getDataShape)
146          .def("getNumDataPointsGlobal",&finley::MeshAdapter::getNumDataPointsGlobal)
147        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)        .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)
148          .def("addPDEToLumpedSystem",&finley::MeshAdapter::addPDEToLumpedSystem)
149        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)        .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)
150          .def("addPDEToTransportProblem",&finley::MeshAdapter::addPDEToTransportProblem)
151        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)        .def("newOperator",&finley::MeshAdapter::newSystemMatrix)
152          .def("newTransportProblem",&finley::MeshAdapter::newTransportProblem)
153        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)        .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)
154          .def("getTransportTypeId",&finley::MeshAdapter::getTransportTypeId)
155        .def("setX",&finley::MeshAdapter::setNewX)        .def("setX",&finley::MeshAdapter::setNewX)
156        .def("getX",&finley::MeshAdapter::getX)        .def("getX",&finley::MeshAdapter::getX)
157        .def("getNormal",&finley::MeshAdapter::getNormal)        .def("getNormal",&finley::MeshAdapter::getNormal)
158        .def("getSize",&finley::MeshAdapter::getSize)        .def("getSize",&finley::MeshAdapter::getSize)
159        .def("saveDX",&finley::MeshAdapter::saveDX)        .def("saveDX",&finley::MeshAdapter::saveDX)
160        .def("saveVTK",&finley::MeshAdapter::saveVTK);        .def("saveVTK",&finley::MeshAdapter::saveVTK)
161          .def("setTagMap",&finley::MeshAdapter::setTagMap)
162          .def("getTag",&finley::MeshAdapter::getTag)
163          .def("isValidTagName",&finley::MeshAdapter::isValidTagName)
164          .def("showTagNames",&finley::MeshAdapter::showTagNames)
165          .def("getMPISize",&finley::MeshAdapter::getMPISize)
166          .def("getMPIRank",&finley::MeshAdapter::getMPIRank);
167    
168    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >    class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >
169        ("OperatorAdapter",no_init)        ("OperatorAdapter",no_init)
170          .def("print_matrix_info",&finley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false))
171        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)        .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)
172        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)        .def("resetValues",&finley::SystemMatrixAdapter::resetValues)
173        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)        .def("saveMM",&finley::SystemMatrixAdapter::saveMM)
174        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);        .def("saveHB",&finley::SystemMatrixAdapter::saveHB);
175    
176      class_<finley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >
177          ("TransportProblemAdapter",no_init)
178          .def("getSafeTimeStepSize",&finley::TransportProblemAdapter::getSafeTimeStepSize)
179          .def("getUnlimitedTimeStepSize",&finley::TransportProblemAdapter::getUnlimitedTimeStepSize)
180          .def("resetTransport",&finley::TransportProblemAdapter::resetTransport);
181  }  }

Legend:
Removed from v.934  
changed lines
  Added in v.1859

  ViewVC Help
Powered by ViewVC 1.1.26