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

Annotation of /trunk/dudley/src/CPPAdapter/dudleycpp.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1370 - (hide annotations)
Wed Jan 2 09:21:43 2008 UTC (11 years, 3 months ago) by gross
Original Path: trunk/finley/src/CPPAdapter/finleycpp.cpp
File size: 7265 byte(s)
explicit upwinding scheme added.
1 jgs 102
2 ksteube 1312 /* $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 ksteube 817 #ifdef PASO_MPI
17     #include <mpi.h>
18     #endif
19 jgs 102 extern "C" {
20 robwdcock 682 #include "../Finley.h"
21 jgs 102 }
22 jgs 472
23 jgs 203 #include "MeshAdapter.h"
24     #include "MeshAdapterFactory.h"
25     #include "SystemMatrixAdapter.h"
26 gross 1364 #include "TransportProblemAdapter.h"
27 jgs 102
28 gross 727 #include "FinleyAdapterException.h"
29     // #include "esysUtils/EsysException.h"
30 robwdcock 682 #include "esysUtils/esysExceptionTranslator.h"
31 jgs 102
32 robwdcock 682 #include "escript/AbstractContinuousDomain.h"
33 jgs 102
34     #include <boost/python.hpp>
35     #include <boost/python/module.hpp>
36     #include <boost/python/def.hpp>
37     #include <boost/python/detail/defaults_gen.hpp>
38    
39     using namespace boost::python;
40    
41     /**
42 jgs 121 \page finley Finley
43     Finley is the python module name that contains the interfaces
44 jgs 102 to the C++ wrapper to finley.
45    
46 jgs 121 \version 1.0.0
47 jgs 102
48 jgs 121 \section class_desc Class Description:
49 jgs 102 Data
50    
51 jgs 121 \section class_limits Class Limitations:
52 jgs 102 None
53    
54 jgs 121 \section class_conds Class Conditions of Use:
55 jgs 102 None
56    
57 jgs 121 \section throws Throws:
58 jgs 102 None
59    
60     */
61    
62     //
63     // The BOOST_PYTHON_FUNCTION_OVERLOADS macro generates function overloads for optional
64     // arguments to the respective finley functions.
65     // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
66     //
67     // NOTE: If the number of arguments to the finley functions change
68     // the magic numbers in the BOOST_PYTHON_FUNCTION_OVERLOADS call
69     // must change.
70     //
71     // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
72     // BOOST_PYTHON_FUNCTION_OVERLOADS(readMesh_overloads,finley::readMesh,1,2)
73     // BOOST_PYTHON_FUNCTION_OVERLOADS(brick_overloads,finley::brick,0,12)
74     // BOOST_PYTHON_FUNCTION_OVERLOADS(rectangle_overloads,finley::rectangle,0,9)
75     // BOOST_PYTHON_FUNCTION_OVERLOADS(interval_overloads,finley::interval,0,6)
76     // BOOST_PYTHON_FUNCTION_OVERLOADS(glueFaces_overloads,finley::glueFaces,1,3)
77     // BOOST_PYTHON_FUNCTION_OVERLOADS(joinFaces_overloads,finley::joinFaces,1,3)
78    
79     BOOST_PYTHON_MODULE(finleycpp)
80     {
81    
82     // def("ReadMesh",finley::readMesh,readMesh_overloads());
83     // def("Brick",finley::brick,brick_overloads());
84     // def("Rectangle",finley::rectangle,rectangle_overloads());
85     // def("Interval",finley::interval,interval_overloads());
86     // def("GlueFaces",finley::glueFaces,glueFaces_overloads());
87     // def("JoinFaces",finley::joinFaces,joinFaces_overloads());
88     //
89     // NOTE: The return_value_policy is necessary for functions that
90     // return pointers.
91    
92 ksteube 1345 def("LoadMesh",finley::loadMesh,
93 ksteube 1312 (arg("fileName")="file.nc"),
94     return_value_policy<manage_new_object>());
95 jgs 102 def("ReadMesh",finley::readMesh,
96 ksteube 1312 (arg("fileName")="file.fly",arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimize")=true),
97 jgs 102 return_value_policy<manage_new_object>());
98 ksteube 1360 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 jgs 102
102 gross 934 def("ReadGmsh",finley::readGmsh,
103 ksteube 1312 (arg("fileName")="file.msh",arg("numDim"), arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1, arg("optimize")=true),
104 gross 934 return_value_policy<manage_new_object>());
105    
106 jgs 102 def ("Brick",finley::brick,
107     (arg("n0")=1,arg("n1")=1,arg("n2")=1,
108     arg("order")=1,
109     arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
110     arg("periodic0")=false,arg("periodic1")=false,arg("periodic2")=false,
111 gross 1059 arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1,
112 ksteube 1312 arg("useElementsOnFace")=false,
113     arg("useFullElementOrder")=false,
114     arg("optimize")=false),
115 jgs 102 return_value_policy<manage_new_object>());
116    
117     def ("Rectangle",finley::rectangle,
118     (arg("n0")=1,arg("n1")=1,arg("order")=1,
119     arg("l0")=1.0,arg("l1")=1.0,
120     arg("periodic0")=false,arg("periodic1")=false,
121 gross 1059 arg("integrationOrder")=-1, arg("reducedIntegrationOrder")=-1,
122 ksteube 1312 arg("useElementsOnFace")=false,
123     arg("useFullElementOrder")=false,
124     arg("optimize")=false),
125 jgs 102 return_value_policy<manage_new_object>());
126    
127 jgs 110 def("Merge",finley::meshMerge,
128     return_value_policy<manage_new_object>());
129    
130 jgs 102 def("GlueFaces",finley::glueFaces,
131     (arg("safetyFactor")=0.2,
132 gross 1062 arg("tolerance")=1.e-8,
133 ksteube 1312 arg("optimize")=true),
134 jgs 102 return_value_policy<manage_new_object>());
135    
136     def("JoinFaces",finley::joinFaces,
137     (arg("safetyFactor")=0.2,
138 gross 1062 arg("tolerance")=1.e-8,
139 ksteube 1312 arg("optimize")=true),
140 jgs 102 return_value_policy<manage_new_object>());
141    
142    
143 gross 1361
144 jgs 102 class_<finley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
145     ("MeshAdapter",init<optional <Finley_Mesh*> >())
146     .def(init<const finley::MeshAdapter&>())
147     .def("write",&finley::MeshAdapter::write)
148 ksteube 1339 .def("print_mesh_info",&finley::MeshAdapter::Print_Mesh_Info,(arg("full")=false))
149 ksteube 1343 .def("dump",&finley::MeshAdapter::dump)
150 jgs 102 .def("getDescription",&finley::MeshAdapter::getDescription)
151     .def("getDim",&finley::MeshAdapter::getDim)
152     .def("getDataShape",&finley::MeshAdapter::getDataShape)
153     .def("addPDEToSystem",&finley::MeshAdapter::addPDEToSystem)
154 gross 1204 .def("addPDEToLumpedSystem",&finley::MeshAdapter::addPDEToLumpedSystem)
155 jgs 102 .def("addPDEToRHS",&finley::MeshAdapter::addPDEToRHS)
156 gross 1370 .def("addPDEToTransportProblem",&finley::MeshAdapter::addPDEToTransportProblem)
157 jgs 102 .def("newOperator",&finley::MeshAdapter::newSystemMatrix)
158 gross 1370 .def("newTransportProblem",&finley::MeshAdapter::newTransportProblem)
159 jgs 102 .def("getSystemMatrixTypeId",&finley::MeshAdapter::getSystemMatrixTypeId)
160 jgs 110 .def("setX",&finley::MeshAdapter::setNewX)
161 jgs 102 .def("getX",&finley::MeshAdapter::getX)
162     .def("getNormal",&finley::MeshAdapter::getNormal)
163 jgs 153 .def("getSize",&finley::MeshAdapter::getSize)
164     .def("saveDX",&finley::MeshAdapter::saveDX)
165 gross 1044 .def("saveVTK",&finley::MeshAdapter::saveVTK)
166     .def("setTagMap",&finley::MeshAdapter::setTagMap)
167     .def("getTag",&finley::MeshAdapter::getTag)
168     .def("isValidTagName",&finley::MeshAdapter::isValidTagName)
169 ksteube 1312 .def("showTagNames",&finley::MeshAdapter::showTagNames)
170     .def("getMPISize",&finley::MeshAdapter::getMPISize)
171     .def("getMPIRank",&finley::MeshAdapter::getMPIRank);
172 jgs 102
173     class_<finley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >
174     ("OperatorAdapter",no_init)
175 ksteube 1339 .def("print_matrix_info",&finley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false))
176 jgs 102 .def("nullifyRowsAndCols",&finley::SystemMatrixAdapter::nullifyRowsAndCols)
177 jgs 149 .def("resetValues",&finley::SystemMatrixAdapter::resetValues)
178 jgs 123 .def("saveMM",&finley::SystemMatrixAdapter::saveMM)
179     .def("saveHB",&finley::SystemMatrixAdapter::saveHB);
180 jgs 102
181 gross 1364 class_<finley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >
182     ("OperatorAdapter",no_init)
183     .def("resetTransport",&finley::TransportProblemAdapter::resetTransport);
184    
185    
186    
187 gross 1361 register_exception_translator<finley::FinleyAdapterException>(&(esysUtils::esysExceptionTranslator));
188    
189 jgs 102 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26