/[escript]/branches/refine/buckley/src/buckleycpp.cpp
ViewVC logotype

Diff of /branches/refine/buckley/src/buckleycpp.cpp

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

revision 3668 by jfenwick, Wed Nov 16 01:49:46 2011 UTC revision 3671 by jfenwick, Wed Nov 16 04:01:53 2011 UTC
# Line 16  Line 16 
16  #include "esysUtils/Esys_MPI.h"  #include "esysUtils/Esys_MPI.h"
17  #endif  #endif
18    
19  #include "RDomain.h"  #include "BuckleyDomain.h"
 // #include "RDomainFactory.h"  
 // #include "SystemMatrixAdapter.h"  
 // #include "TransportProblemAdapter.h"  
20    
21  #include "RDomainException.h"  #include "BuckleyException.h"
22  #include "esysUtils/esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
23    
24  #include "escript/AbstractContinuousDomain.h"  #include "escript/AbstractContinuousDomain.h"
# Line 65  BOOST_PYTHON_MODULE(buckleycpp) Line 62  BOOST_PYTHON_MODULE(buckleycpp)
62    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
63    // return pointers.    // return pointers.
64    //    //
65    register_exception_translator<buckley::RDomainException>(&(esysUtils::esysExceptionTranslator));    register_exception_translator<buckley::BuckleyException>(&(esysUtils::esysExceptionTranslator));
66    
67  //   def("LoadMesh",buckley::loadMesh,  //   def("LoadMesh",buckley::loadMesh,
68  //       (arg("fileName")="file.nc"),":rtype: `Domain`"  //       (arg("fileName")="file.nc"),":rtype: `Domain`"
# Line 106  BOOST_PYTHON_MODULE(buckleycpp) Line 103  BOOST_PYTHON_MODULE(buckleycpp)
103  // );  // );
104    
105    
106    class_<buckley::RDomain, bases<escript::AbstractContinuousDomain> >    class_<buckley::BuckleyDomain, bases<escript::AbstractContinuousDomain> >
107        ("RDomain","A concrete class representing a domain. For more details, please consult the c++ documentation.",init<double, double, double>())        ("BuckleyDomain","A concrete class representing a domain. For more details, please consult the c++ documentation.",init<double, double, double>())
108        .def(init<const buckley::RDomain&>())        .def(init<const buckley::BuckleyDomain&>())
109        .def("write",&buckley::RDomain::write,args("filename"),        .def("write",&buckley::BuckleyDomain::write,args("filename"),
110  "Write the current mesh to a file with the given name.")  "Write the current mesh to a file with the given name.")
111        .def("print_mesh_info",&buckley::RDomain::Print_Mesh_Info,(arg("full")=false),        .def("print_mesh_info",&buckley::BuckleyDomain::Print_Mesh_Info,(arg("full")=false),
112  ":param full:\n:type full: ``bool``")  ":param full:\n:type full: ``bool``")
113        .def("dump",&buckley::RDomain::dump,args("fileName")        .def("dump",&buckley::BuckleyDomain::dump,args("fileName")
114  ,"dumps the mesh to a file with the given name.")  ,"dumps the mesh to a file with the given name.")
115        .def("getDescription",&buckley::RDomain::getDescription,        .def("getDescription",&buckley::BuckleyDomain::getDescription,
116  ":return: a description for this domain\n:rtype: ``string``")  ":return: a description for this domain\n:rtype: ``string``")
117        .def("getDim",&buckley::RDomain::getDim,":rtype: ``int``")        .def("getDim",&buckley::BuckleyDomain::getDim,":rtype: ``int``")
118        .def("getDataShape",&buckley::RDomain::getDataShape, args("functionSpaceCode"),        .def("getDataShape",&buckley::BuckleyDomain::getDataShape, args("functionSpaceCode"),
119  ":return: a pair (dps, ns) where dps=the number of data points per sample, and ns=the number of samples\n:rtype: ``tuple``")  ":return: a pair (dps, ns) where dps=the number of data points per sample, and ns=the number of samples\n:rtype: ``tuple``")
120        .def("getNumDataPointsGlobal",&buckley::RDomain::getNumDataPointsGlobal,        .def("getNumDataPointsGlobal",&buckley::BuckleyDomain::getNumDataPointsGlobal,
121  ":return: the number of data points summed across all MPI processes\n"  ":return: the number of data points summed across all MPI processes\n"
122  ":rtype: ``int``")  ":rtype: ``int``")
123        .def("addPDEToSystem",&buckley::RDomain::addPDEToSystem,        .def("addPDEToSystem",&buckley::BuckleyDomain::addPDEToSystem,
124  args("mat", "rhs","A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),  args("mat", "rhs","A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
125  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"
126  ":param mat:\n:type mat: `OperatorAdapter`\n:param rhs:\n:type rhs: `Data`\n"  ":param mat:\n:type mat: `OperatorAdapter`\n:param rhs:\n:type rhs: `Data`\n"
# Line 138  args("mat", "rhs","A", "B", "C", "D", "X Line 135  args("mat", "rhs","A", "B", "C", "D", "X
135  ":param y_contact:\n:type y_contact: `Data`\n"  ":param y_contact:\n:type y_contact: `Data`\n"
136  )  )
137    
138        .def("addPDEToRHS",&buckley::RDomain::addPDEToRHS,        .def("addPDEToRHS",&buckley::BuckleyDomain::addPDEToRHS,
139  args("rhs", "X", "Y", "y", "y_contact"),  args("rhs", "X", "Y", "y", "y_contact"),
140  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"
141  ":param rhs:\n:type rhs: `Data`\n"  ":param rhs:\n:type rhs: `Data`\n"
# Line 147  args("rhs", "X", "Y", "y", "y_contact"), Line 144  args("rhs", "X", "Y", "y", "y_contact"),
144  ":param y:\n:type y: `Data`\n"  ":param y:\n:type y: `Data`\n"
145  ":param y_contact:\n:type y_contact: `Data`"  ":param y_contact:\n:type y_contact: `Data`"
146  )  )
147        .def("addPDEToTransportProblem",&buckley::RDomain::addPDEToTransportProblem,        .def("addPDEToTransportProblem",&buckley::BuckleyDomain::addPDEToTransportProblem,
148  args( "tp", "source", "M", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),  args( "tp", "source", "M", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
149  ":param tp:\n:type tp: `TransportProblemAdapter`\n"  ":param tp:\n:type tp: `TransportProblemAdapter`\n"
150  ":param source:\n:type source: `Data`\n"  ":param source:\n:type source: `Data`\n"
# Line 163  args( "tp", "source", "M", "A", "B", "C" Line 160  args( "tp", "source", "M", "A", "B", "C"
160  ":param d_contact:\n:type d_contact: `Data`\n"  ":param d_contact:\n:type d_contact: `Data`\n"
161  ":param y_contact:\n:type y_contact: `Data`\n"  ":param y_contact:\n:type y_contact: `Data`\n"
162  )  )
163        .def("newOperator",&buckley::RDomain::newSystemMatrix,        .def("newOperator",&buckley::BuckleyDomain::newSystemMatrix,
164  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),
165  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"
166  ":param row_blocksize:\n:type row_blocksize: ``int``\n"  ":param row_blocksize:\n:type row_blocksize: ``int``\n"
# Line 172  args("row_blocksize", "row_functionspace Line 169  args("row_blocksize", "row_functionspace
169  ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"  ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"
170  ":param type:\n:type type: ``int``\n"  ":param type:\n:type type: ``int``\n"
171  )  )
172        .def("newTransportProblem",&buckley::RDomain::newTransportProblem,        .def("newTransportProblem",&buckley::BuckleyDomain::newTransportProblem,
173  args("theta", "blocksize", "functionspace", "type"),  args("theta", "blocksize", "functionspace", "type"),
174  "creates a TransportProblemAdapter\n\n"  "creates a TransportProblemAdapter\n\n"
175  ":param theta:\n:type theta: ``float``\n"  ":param theta:\n:type theta: ``float``\n"
# Line 180  args("theta", "blocksize", "functionspac Line 177  args("theta", "blocksize", "functionspac
177  ":param functionspace:\n:type functionspace: `FunctionSpace`\n"  ":param functionspace:\n:type functionspace: `FunctionSpace`\n"
178  ":param type:\n:type type: ``int``\n"  ":param type:\n:type type: ``int``\n"
179  )  )
180        .def("getSystemMatrixTypeId",&buckley::RDomain::getSystemMatrixTypeId,        .def("getSystemMatrixTypeId",&buckley::BuckleyDomain::getSystemMatrixTypeId,
181  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
182  ":return: the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, package, perconditioner, and symmetric matrix is used.\n"  ":return: the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, package, perconditioner, and symmetric matrix is used.\n"
183  ":rtype: ``int``\n"  ":rtype: ``int``\n"
# Line 189  args("solver", "preconditioner", "packag Line 186  args("solver", "preconditioner", "packag
186  ":param package:\n:type package: ``int``\n"  ":param package:\n:type package: ``int``\n"
187  ":param symmetry:\n:type symmetry: ``int``\n"  ":param symmetry:\n:type symmetry: ``int``\n"
188  )  )
189        .def("getTransportTypeId",&buckley::RDomain::getTransportTypeId,        .def("getTransportTypeId",&buckley::BuckleyDomain::getTransportTypeId,
190  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
191  ":return: the identifier of the transport problem type to be used when a particular solver, perconditioner, package and symmetric matrix is used.\n"  ":return: the identifier of the transport problem type to be used when a particular solver, perconditioner, package and symmetric matrix is used.\n"
192  ":rtype: ``int``\n"  ":rtype: ``int``\n"
# Line 198  args("solver", "preconditioner", "packag Line 195  args("solver", "preconditioner", "packag
195  ":param package:\n:type package: ``int``\n"  ":param package:\n:type package: ``int``\n"
196  ":param symmetry:\n:type symmetry: ``int``\n"  ":param symmetry:\n:type symmetry: ``int``\n"
197  )  )
198        .def("setX",&buckley::RDomain::setNewX,        .def("setX",&buckley::BuckleyDomain::setNewX,
199  args("arg"), "assigns new location to the domain\n\n:param arg:\n:type arg: `Data`")  args("arg"), "assigns new location to the domain\n\n:param arg:\n:type arg: `Data`")
200        .def("getX",&buckley::RDomain::getX, ":return: locations in the FEM nodes\n\n"        .def("getX",&buckley::BuckleyDomain::getX, ":return: locations in the FEM nodes\n\n"
201  ":rtype: `Data`")  ":rtype: `Data`")
202        .def("getNormal",&buckley::RDomain::getNormal,        .def("getNormal",&buckley::BuckleyDomain::getNormal,
203  ":return: boundary normals at the quadrature point on the face elements\n"  ":return: boundary normals at the quadrature point on the face elements\n"
204  ":rtype: `Data`")  ":rtype: `Data`")
205        .def("getSize",&buckley::RDomain::getSize,":return: the element size\n"        .def("getSize",&buckley::BuckleyDomain::getSize,":return: the element size\n"
206  ":rtype: `Data`")  ":rtype: `Data`")
207        .def("saveDX",&buckley::RDomain::saveDX,args("filename" ,"arg"),        .def("saveDX",&buckley::BuckleyDomain::saveDX,args("filename" ,"arg"),
208  "Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier"  "Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier"
209  "\n\n:param filename: \n:type filename: ``string``\n"  "\n\n:param filename: \n:type filename: ``string``\n"
210  "\n:param arg: \n:type arg: ``dict``\n")  "\n:param arg: \n:type arg: ``dict``\n")
211        .def("saveVTK",&buckley::RDomain::saveVTK,        .def("saveVTK",&buckley::BuckleyDomain::saveVTK,
212  args("filename" ,"arg",  "metadata", "metadata_schema"),  args("filename" ,"arg",  "metadata", "metadata_schema"),
213  "Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier"  "Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier"
214  "\n\n:param filename:\n:type filename: ``string``\n"  "\n\n:param filename:\n:type filename: ``string``\n"
# Line 219  args("filename" ,"arg",  "metadata", "me Line 216  args("filename" ,"arg",  "metadata", "me
216  ":param metadata:\n:type metadata: ``string``\n"  ":param metadata:\n:type metadata: ``string``\n"
217  ":param metadata_schema:\n:type metadata_schema: ``string``\n"  ":param metadata_schema:\n:type metadata_schema: ``string``\n"
218  )  )
219        .def("setTagMap",&buckley::RDomain::setTagMap,args("name","tag"),        .def("setTagMap",&buckley::BuckleyDomain::setTagMap,args("name","tag"),
220  "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"  "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"
221  ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")  ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")
222        .def("getTag",&buckley::RDomain::getTag,args("name"),":return: tag id for "        .def("getTag",&buckley::BuckleyDomain::getTag,args("name"),":return: tag id for "
223  "``name``\n:rtype: ``string``")  "``name``\n:rtype: ``string``")
224        .def("isValidTagName",&buckley::RDomain::isValidTagName,args("name"),        .def("isValidTagName",&buckley::BuckleyDomain::isValidTagName,args("name"),
225  ":return: True is ``name`` corresponds to a tag\n:rtype: ``bool``")  ":return: True is ``name`` corresponds to a tag\n:rtype: ``bool``")
226        .def("showTagNames",&buckley::RDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")        .def("showTagNames",&buckley::BuckleyDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")
227        .def("getMPISize",&buckley::RDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")        .def("getMPISize",&buckley::BuckleyDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")
228        .def("getMPIRank",&buckley::RDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")        .def("getMPIRank",&buckley::BuckleyDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")
229        .def("MPIBarrier",&buckley::RDomain::MPIBarrier,"Wait until all processes have reached this point")        .def("MPIBarrier",&buckley::BuckleyDomain::MPIBarrier,"Wait until all processes have reached this point")
230        .def("onMasterProcessor",&buckley::RDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");        .def("onMasterProcessor",&buckley::BuckleyDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");
231    
232  }  }

Legend:
Removed from v.3668  
changed lines
  Added in v.3671

  ViewVC Help
Powered by ViewVC 1.1.26