Changeset 13310


Ignore:
Timestamp:
09/10/12 11:49:50 (13 years ago)
Author:
jschierm
Message:

NEW: Preliminary python FetchData for BamgGeom, BamgMesh, and BamgOpts.

Location:
issm/trunk-jpl/src/c/python/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/python/io/FetchPythonData.cpp

    r13287 r13310  
    137137}
    138138/*}}}*/
    139 /*FUNCTION FetchData(BamgGeom** bamggeom,PyObject* py_ref) {{{*/
    140 void FetchData(BamgGeom** bamggeom,PyObject* py_ref){
    141          _error_("not implemented yet (good luck John!)");
    142 }
    143 /*}}}*/
    144 /*FUNCTION FetchData(BamgMesh** bamggeom,PyObject* py_ref) {{{*/
    145 void FetchData(BamgMesh** bamggeom,PyObject* py_ref){
    146         _error_("not implemented yet (good luck John!)");
    147 }
    148 /*}}}*/
    149 /*FUNCTION FetchData(BamgOpts** bamggeom,PyObject* py_ref) {{{*/
    150 void FetchData(BamgOpts** bamggeom,PyObject* py_ref){
    151          _error_("not implemented yet (good luck John!)");
     139
     140/*ISSM objects*/
     141/*FUNCTION FetchData(BamgGeom** pbamggeom,PyObject* py_dict){{{*/
     142void FetchData(BamgGeom** pbamggeom,PyObject* py_dict){
     143
     144        /*Initialize output*/
     145        BamgGeom* bamggeom=new BamgGeom();
     146
     147        /*Fetch all fields*/
     148        FetchData(&bamggeom->Vertices,&bamggeom->VerticesSize[0],&bamggeom->VerticesSize[1],PyDict_GetItemString(py_dict,"Vertices"));
     149        FetchData(&bamggeom->Edges, &bamggeom->EdgesSize[0], &bamggeom->EdgesSize[1], PyDict_GetItemString(py_dict,"Edges"));
     150        FetchData(&bamggeom->Corners, &bamggeom->CornersSize[0], &bamggeom->CornersSize[1], PyDict_GetItemString(py_dict,"Corners"));
     151        FetchData(&bamggeom->RequiredVertices,&bamggeom->RequiredVerticesSize[0],&bamggeom->RequiredVerticesSize[1],PyDict_GetItemString(py_dict,"RequiredVertices"));
     152        FetchData(&bamggeom->RequiredEdges, &bamggeom->RequiredEdgesSize[0], &bamggeom->RequiredEdgesSize[1], PyDict_GetItemString(py_dict,"RequiredEdges"));
     153        FetchData(&bamggeom->CrackedEdges,&bamggeom->CrackedEdgesSize[0],&bamggeom->CrackedEdgesSize[1],PyDict_GetItemString(py_dict,"CrackedEdges"));
     154        FetchData(&bamggeom->SubDomains,&bamggeom->SubDomainsSize[0],&bamggeom->SubDomainsSize[1],PyDict_GetItemString(py_dict,"SubDomains"));
     155
     156        /*Assign output pointers:*/
     157        *pbamggeom=bamggeom;
     158}
     159/*}}}*/
     160/*FUNCTION FetchData(BamgMesh** pbamgmesh,PyObject* py_dict){{{*/
     161void FetchData(BamgMesh** pbamgmesh,PyObject* py_dict){
     162
     163        /*Initialize output*/
     164        BamgMesh* bamgmesh=new BamgMesh();
     165
     166        /*Fetch all fields*/
     167        FetchData(&bamgmesh->Vertices,&bamgmesh->VerticesSize[0],&bamgmesh->VerticesSize[1],PyDict_GetItemString(py_dict,"Vertices"));
     168        FetchData(&bamgmesh->Edges, &bamgmesh->EdgesSize[0], &bamgmesh->EdgesSize[1], PyDict_GetItemString(py_dict,"Edges"));
     169        FetchData(&bamgmesh->Triangles, &bamgmesh->TrianglesSize[0], &bamgmesh->TrianglesSize[1], PyDict_GetItemString(py_dict,"Triangles"));
     170        FetchData(&bamgmesh->CrackedEdges,&bamgmesh->CrackedEdgesSize[0],&bamgmesh->CrackedEdgesSize[1],PyDict_GetItemString(py_dict,"CrackedEdges"));
     171        FetchData(&bamgmesh->VerticesOnGeomEdge,&bamgmesh->VerticesOnGeomEdgeSize[0],&bamgmesh->VerticesOnGeomEdgeSize[1],PyDict_GetItemString(py_dict,"VerticesOnGeomEdge"));
     172        FetchData(&bamgmesh->VerticesOnGeomVertex,&bamgmesh->VerticesOnGeomVertexSize[0],&bamgmesh->VerticesOnGeomVertexSize[1],PyDict_GetItemString(py_dict,"VerticesOnGeomVertex"));
     173        FetchData(&bamgmesh->EdgesOnGeomEdge, &bamgmesh->EdgesOnGeomEdgeSize[0], &bamgmesh->EdgesOnGeomEdgeSize[1], PyDict_GetItemString(py_dict,"EdgesOnGeomEdge"));
     174        FetchData(&bamgmesh->IssmSegments,&bamgmesh->IssmSegmentsSize[0],&bamgmesh->IssmSegmentsSize[1],PyDict_GetItemString(py_dict,"IssmSegments"));
     175
     176        /*Assign output pointers:*/
     177        *pbamgmesh=bamgmesh;
     178}
     179/*}}}*/
     180/*FUNCTION FetchData(BamgOpts** pbamgopts,PyObject* py_dict){{{*/
     181void FetchData(BamgOpts** pbamgopts,PyObject* py_dict){
     182
     183        /*Initialize output*/
     184        BamgOpts* bamgopts=new BamgOpts();
     185
     186        /*Fetch all fields*/
     187        FetchData(&bamgopts->anisomax,PyDict_GetItemString(py_dict,"anisomax"));
     188        FetchData(&bamgopts->cutoff,PyDict_GetItemString(py_dict,"cutoff"));
     189        FetchData(&bamgopts->coeff,PyDict_GetItemString(py_dict,"coeff"));
     190        FetchData(&bamgopts->errg,PyDict_GetItemString(py_dict,"errg"));
     191        FetchData(&bamgopts->gradation,PyDict_GetItemString(py_dict,"gradation"));
     192        FetchData(&bamgopts->Hessiantype,PyDict_GetItemString(py_dict,"Hessiantype"));
     193        FetchData(&bamgopts->MaxCornerAngle,PyDict_GetItemString(py_dict,"MaxCornerAngle"));
     194        FetchData(&bamgopts->maxnbv,PyDict_GetItemString(py_dict,"maxnbv"));
     195        FetchData(&bamgopts->maxsubdiv,PyDict_GetItemString(py_dict,"maxsubdiv"));
     196        FetchData(&bamgopts->Metrictype,PyDict_GetItemString(py_dict,"Metrictype"));
     197        FetchData(&bamgopts->nbjacobi,PyDict_GetItemString(py_dict,"nbjacobi"));
     198        FetchData(&bamgopts->nbsmooth,PyDict_GetItemString(py_dict,"nbsmooth"));
     199        FetchData(&bamgopts->omega,PyDict_GetItemString(py_dict,"omega"));
     200        FetchData(&bamgopts->power,PyDict_GetItemString(py_dict,"power"));
     201        FetchData(&bamgopts->verbose,PyDict_GetItemString(py_dict,"verbose"));
     202
     203        FetchData(&bamgopts->Crack,PyDict_GetItemString(py_dict,"Crack"));
     204        FetchData(&bamgopts->geometricalmetric,PyDict_GetItemString(py_dict,"geometricalmetric"));
     205        FetchData(&bamgopts->KeepVertices,PyDict_GetItemString(py_dict,"KeepVertices"));
     206        FetchData(&bamgopts->splitcorners,PyDict_GetItemString(py_dict,"splitcorners"));
     207
     208        FetchData(&bamgopts->hmin,PyDict_GetItemString(py_dict,"hmin"));
     209        FetchData(&bamgopts->hmax,PyDict_GetItemString(py_dict,"hmax"));
     210        FetchData(&bamgopts->hminVertices,&bamgopts->hminVerticesSize[0],&bamgopts->hminVerticesSize[1],PyDict_GetItemString(py_dict,"hminVertices"));
     211        FetchData(&bamgopts->hmaxVertices,&bamgopts->hmaxVerticesSize[0],&bamgopts->hmaxVerticesSize[1],PyDict_GetItemString(py_dict,"hmaxVertices"));
     212        FetchData(&bamgopts->hVertices,&bamgopts->hVerticesSize[0],&bamgopts->hVerticesSize[1],PyDict_GetItemString(py_dict,"hVertices"));
     213        FetchData(&bamgopts->metric,&bamgopts->metricSize[0],&bamgopts->metricSize[1],PyDict_GetItemString(py_dict,"metric"));
     214        FetchData(&bamgopts->field,&bamgopts->fieldSize[0],&bamgopts->fieldSize[1],PyDict_GetItemString(py_dict,"field"));
     215        FetchData(&bamgopts->err,&bamgopts->errSize[0],&bamgopts->errSize[1],PyDict_GetItemString(py_dict,"err"));
     216
     217        /*Additional checks*/
     218        bamgopts->Check();
     219
     220        /*Assign output pointers:*/
     221        *pbamgopts=bamgopts;
    152222}
    153223/*}}}*/
  • issm/trunk-jpl/src/c/python/io/pythonio.h

    r13287 r13310  
    3131void FetchData(int* pinteger,PyObject* py_long);
    3232void FetchData(bool* pbool,PyObject* py_boolean);
    33 void FetchData(BamgGeom** bamggeom,PyObject* py_ref);
    34 void FetchData(BamgMesh** bamgmesh,PyObject* py_ref);
    35 void FetchData(BamgOpts** bamgopts,PyObject* py_ref);
     33void FetchData(BamgGeom** bamggeom,PyObject* py_dict);
     34void FetchData(BamgMesh** bamgmesh,PyObject* py_dict);
     35void FetchData(BamgOpts** bamgopts,PyObject* py_dict);
    3636void FetchData(Options** poptions,int istart, int nrhs,PyObject* arguments);
    3737
Note: See TracChangeset for help on using the changeset viewer.