Changeset 9405


Ignore:
Timestamp:
08/24/11 12:10:50 (14 years ago)
Author:
Mathieu Morlighem
Message:

moved iomodel->f to iomodel->Data and iomodel->constants is now private (use iomodel->Constant)

Location:
issm/trunk/src
Files:
1 added
62 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r9401 r9405  
    553553        SpcDynamicEnum,
    554554        NumberOfEdgesEnum,
     555        ResultsOnVerticesEnum,
    555556        MaximumNumberOfEnums
    556557};
  • issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp

    r9401 r9405  
    495495                case SpcDynamicEnum : return "SpcDynamic";
    496496                case NumberOfEdgesEnum : return "NumberOfEdges";
     497                case ResultsOnVerticesEnum : return "ResultsOnVertices";
    497498                default : return "unknown";
    498499
  • issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp

    r9362 r9405  
    3333
    3434        /*Fetch parameters: */
    35         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     35        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    3636
    3737        /*First of, find the record for the enum, and get code  of data type: */
  • issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp

    r9362 r9405  
    1313       
    1414        /*Fetch parameters: */
    15         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
     15        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
    1616
    1717        /*Output*/
  • issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp

    r9391 r9405  
    2020
    2121        /*Fetch parameters: */
    22         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
    23         iomodel->constants->FindParam(&numberofedges,NumberOfEdgesEnum);
     22        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
     23        iomodel->Constant(&numberofedges,NumberOfEdgesEnum);
    2424
    2525        /*Output*/
     
    4242
    4343                        /*Get left and right elements*/
    44                         element=(int)iomodel->f(EdgesEnum)[4*i+2]-1; //edges are [node1 node2 elem1 elem2]
     44                        element=(int)iomodel->Data(EdgesEnum)[4*i+2]-1; //edges are [node1 node2 elem1 elem2]
    4545
    4646                        /*Now, if this element is not in the partition, pass: */
  • issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp

    r9372 r9405  
    3030
    3131        /*Fetch parameters: */
    32         iomodel->constants->FindParam(&dim,DimEnum);
    33         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    34         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    35         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
     32        iomodel->Constant(&dim,DimEnum);
     33        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     34        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     35        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
    3636
    3737        /*Recover pointer: */
     
    7272
    7373                                        //Get index of the vertex on which the current node is located
    74                                         vertex_id=(int)*(iomodel->f(ElementsEnum)+3*i+j); //(Matlab indexing)
     74                                        vertex_id=(int)*(iomodel->Data(ElementsEnum)+3*i+j); //(Matlab indexing)
    7575                                        io_index=vertex_id-1;                      //(C indexing)
    7676                                        _assert_(vertex_id>0 && vertex_id<=numberofvertices);
  • issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp

    r9372 r9405  
    2020
    2121        /*Fetch data needed: */
    22         iomodel->constants->FindParam(&dim,DimEnum);
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     22        iomodel->Constant(&dim,DimEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2424        iomodel->FetchData(1,ElementsEnum);
    2525
  • issm/trunk/src/c/modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp

    r9370 r9405  
    2424
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2727
    2828        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp

    r9370 r9405  
    2020
    2121        /*Fetch data needed: */
    22         iomodel->constants->FindParam(&dim,DimEnum);
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     22        iomodel->Constant(&dim,DimEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2424        iomodel->FetchData(1,ElementsEnum);
    2525
  • issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp

    r9370 r9405  
    2727       
    2828        /*Fetch parameters: */
    29         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    30         iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum);
    31         iomodel->constants->FindParam(&num_control_type,NumControlTypeEnum);
     29        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     30        iomodel->Constant(&control_analysis,ControlAnalysisEnum);
     31        iomodel->Constant(&num_control_type,NumControlTypeEnum);
    3232
    3333        /*Now, return if no control*/
     
    4242        iomodel->FetchData(4,ControlTypeEnum,WeightsEnum,CmMinEnum,CmMaxEnum);
    4343        for(i=0;i<num_control_type;i++){
    44                 switch((int)iomodel->f(ControlTypeEnum)[i]){
     44                switch((int)iomodel->Data(ControlTypeEnum)[i]){
    4545                        case DhdtEnum: iomodel->FetchData(1,DhdtEnum); break;
    4646                        case VxEnum:   iomodel->FetchData(1,VxEnum); break;
     
    4848                        case DragCoefficientEnum: iomodel->FetchData(1,DragCoefficientEnum); break;
    4949                        case RheologyBbarEnum:    iomodel->FetchData(1,RheologyBEnum); break;
    50                         default: _error_("Control %s not implemented yet",EnumToStringx((int)iomodel->f(ControlTypeEnum)[i]));
     50                        default: _error_("Control %s not implemented yet",EnumToStringx((int)iomodel->Data(ControlTypeEnum)[i]));
    5151                }
    5252        }
  • issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp

    r9374 r9405  
    2828
    2929        /*Fetch parameters: */
    30         iomodel->constants->FindParam(&dim,DimEnum);
    31         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    32         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    33         iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum);
     30        iomodel->Constant(&dim,DimEnum);
     31        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     32        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     33        iomodel->Constant(&control_analysis,ControlAnalysisEnum);
    3434
    3535        /*Did we already create the elements? : */
  • issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp

    r9362 r9405  
    2929
    3030        /*Fetch parameters: */
    31         iomodel->constants->FindParam(&dim,DimEnum);
    32         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    33         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    34         elements=iomodel->f(ElementsEnum);
     31        iomodel->Constant(&dim,DimEnum);
     32        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     33        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     34        elements=iomodel->Data(ElementsEnum);
    3535
    3636        /*Some checks if debugging*/
  • issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r9393 r9405  
    2222               
    2323        /*Initialize dataset: */
    24         parameters = (Parameters*)iomodel->constants->Copy();
     24        parameters = iomodel->CopyConstants();
    2525
    2626        /*some parameters that did not come with the iomodel: */
  • issm/trunk/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp

    r9370 r9405  
    3232
    3333        /*Fetch parameters: */
    34         iomodel->constants->FindParam(&dim,DimEnum);
    35         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    36         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    37         elements=iomodel->f(ElementsEnum);
     34        iomodel->Constant(&dim,DimEnum);
     35        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     36        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     37        elements=iomodel->Data(ElementsEnum);
    3838
    3939        /*Some checks if debugging*/
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp

    r9370 r9405  
    4040
    4141        /*Fetch parameters: */
    42         iomodel->constants->FindParam(&dim,DimEnum);
    43         iomodel->constants->FindParam(&yts,YtsEnum);
    44         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    45         iomodel->constants->FindParam(&g,GEnum);
    46         iomodel->constants->FindParam(&rho_ice,RhoIceEnum);
    47         iomodel->constants->FindParam(&stokesreconditioning,StokesreconditioningEnum);
    48         iomodel->constants->FindParam(&isstokes,IsstokesEnum);
    49         iomodel->constants->FindParam(&ismacayealpattyn,IsmacayealpattynEnum);
     42        iomodel->Constant(&dim,DimEnum);
     43        iomodel->Constant(&yts,YtsEnum);
     44        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     45        iomodel->Constant(&g,GEnum);
     46        iomodel->Constant(&rho_ice,RhoIceEnum);
     47        iomodel->Constant(&stokesreconditioning,StokesreconditioningEnum);
     48        iomodel->Constant(&isstokes,IsstokesEnum);
     49        iomodel->Constant(&ismacayealpattyn,IsmacayealpattynEnum);
    5050
    5151        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r9391 r9405  
    4242
    4343        /*Fetch parameters: */
    44         iomodel->constants->FindParam(&dim,DimEnum);
    45         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    46         iomodel->constants->FindParam(&isstokes,IsstokesEnum);
    47         iomodel->constants->FindParam(&ismacayealpattyn,IsmacayealpattynEnum);
    48         iomodel->constants->FindParam(&numrifts,NumriftsEnum);
     44        iomodel->Constant(&dim,DimEnum);
     45        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     46        iomodel->Constant(&isstokes,IsstokesEnum);
     47        iomodel->Constant(&ismacayealpattyn,IsmacayealpattynEnum);
     48        iomodel->Constant(&numrifts,NumriftsEnum);
    4949
    5050        /*Recover pointer: */
     
    177177                iomodel->FetchData(5,RiftinfoEnum,ThicknessEnum,BedEnum,SurfaceEnum,NodeOnIceShelfEnum);
    178178                for(i=0;i<numrifts;i++){
    179                         if(iomodel->my_elements[(int)(iomodel->f(RiftinfoEnum)[RIFTINFOSIZE*i+2])-1]){
     179                        if(iomodel->my_elements[(int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+2)-1]){
    180180                                loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
    181181                                count++;
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp

    r9375 r9405  
    2525
    2626        /*Fetch parameters: */
    27         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    28         iomodel->constants->FindParam(&isstokes,IsstokesEnum);
    29         iomodel->constants->FindParam(&ismacayealpattyn,IsmacayealpattynEnum);
     27        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     28        iomodel->Constant(&isstokes,IsstokesEnum);
     29        iomodel->Constant(&ismacayealpattyn,IsmacayealpattynEnum);
    3030
    3131        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp

    r9370 r9405  
    2424
    2525        /*Fetch constants needed: */
    26         iomodel->constants->FindParam(&isstokes,IsstokesEnum);
    27         iomodel->constants->FindParam(&ismacayealpattyn,IsmacayealpattynEnum);
    28         iomodel->constants->FindParam(&dim,DimEnum);
    29         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    30         iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum);
    31         iomodel->constants->FindParam(&qmu_analysis,QmuAnalysisEnum);
     26        iomodel->Constant(&isstokes,IsstokesEnum);
     27        iomodel->Constant(&ismacayealpattyn,IsmacayealpattynEnum);
     28        iomodel->Constant(&dim,DimEnum);
     29        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     30        iomodel->Constant(&control_analysis,ControlAnalysisEnum);
     31        iomodel->Constant(&qmu_analysis,QmuAnalysisEnum);
    3232
    3333        /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp

    r9370 r9405  
    2828
    2929        /*Fetch parameters: */
    30         iomodel->constants->FindParam(&yts,YtsEnum);
    31         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    32         iomodel->constants->FindParam(&ishutter,IshutterEnum);
     30        iomodel->Constant(&yts,YtsEnum);
     31        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     32        iomodel->Constant(&ishutter,IshutterEnum);
    3333
    3434        /*Create constraints if they do not exist yet*/
     
    5151                /*keep only this partition's nodes:*/
    5252                if((iomodel->my_vertices[i])){
    53                         if (!(int)iomodel->f(NodeOnHutterEnum)[i]){
     53                        if (!(int)iomodel->Data(NodeOnHutterEnum)[i]){
    5454
    5555                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,DiagnosticHutterAnalysisEnum));
     
    6060                        }
    6161                        else{
    62                                 if (!isnan(iomodel->f(SpcvxEnum)[i])){
    63                                         constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->f(SpcvxEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
     62                                if (!isnan(iomodel->Data(SpcvxEnum)[i])){
     63                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(SpcvxEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    6464                                        count++;
    6565                                }
    6666
    67                                 if (!isnan(iomodel->f(SpcvyEnum)[i])){
    68                                         constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->f(SpcvyEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
     67                                if (!isnan(iomodel->Data(SpcvyEnum)[i])){
     68                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->Data(SpcvyEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
    6969                                        count++;
    7070                                }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp

    r9370 r9405  
    2525
    2626        /*Fetch parameters: */
    27         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    28         iomodel->constants->FindParam(&ishutter,IshutterEnum);
     27        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     28        iomodel->Constant(&ishutter,IshutterEnum);
    2929
    3030        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp

    r9370 r9405  
    2121       
    2222        /*Fetch data needed: */
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    24         iomodel->constants->FindParam(&ishutter,IshutterEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     24        iomodel->Constant(&ishutter,IshutterEnum);
    2525
    2626        /*Now, is the flag hutter on? otherwise, do nothing: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp

    r9370 r9405  
    2424
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&dim,DimEnum);
    27         iomodel->constants->FindParam(&yts,YtsEnum);
    28         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&dim,DimEnum);
     27        iomodel->Constant(&yts,YtsEnum);
     28        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2929
    3030        /*Recover pointer: */
     
    5252                if(iomodel->my_vertices[i]){
    5353
    54                         if ((int)iomodel->f(NodeOnStokesEnum)[i]){
     54                        if ((int)iomodel->Data(NodeOnStokesEnum)[i]){
    5555                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,DiagnosticVertAnalysisEnum)); //spc to zero as vertical velocity is done in Horiz for Stokes
    5656                                count++;
    5757                        }
    58                         else if (!isnan(iomodel->f(SpcvzEnum)[i])){
     58                        else if (!isnan(iomodel->Data(SpcvzEnum)[i])){
    5959                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,
    60                                                                 iomodel->f(SpcvzEnum)[i]/yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
     60                                                                iomodel->Data(SpcvzEnum)[i]/yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    6161                                count++;
    6262
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp

    r9370 r9405  
    2525
    2626        /*Fetch parameters: */
    27         iomodel->constants->FindParam(&dim,DimEnum);
    28         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     27        iomodel->Constant(&dim,DimEnum);
     28        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2929
    3030        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp

    r9370 r9405  
    2020
    2121        /*Fetch parameters: */
    22         iomodel->constants->FindParam(&dim,DimEnum);
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     22        iomodel->Constant(&dim,DimEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2424
    2525        /*Now, is the model 3d? otherwise, do nothing: */
  • issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r9391 r9405  
    4848
    4949        /*Fetch parameters: */
    50         iomodel->constants->FindParam(&dim,DimEnum);
    51         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    52         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    53         iomodel->constants->FindParam(&numberofelements2d,NumberOfElements2DEnum);
    54         iomodel->constants->FindParam(&numberofvertices2d,NumberOfNodes2DEnum);
    55         iomodel->constants->FindParam(&numlayers,NumlayersEnum);
    56         iomodel->constants->FindParam(&numrifts,NumriftsEnum);
     50        iomodel->Constant(&dim,DimEnum);
     51        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     52        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     53        iomodel->Constant(&numberofelements2d,NumberOfElements2DEnum);
     54        iomodel->Constant(&numberofvertices2d,NumberOfNodes2DEnum);
     55        iomodel->Constant(&numlayers,NumlayersEnum);
     56        iomodel->Constant(&numrifts,NumriftsEnum);
    5757
    5858        /*First, check that partitioning has not yet been carryed out. Just check whether my_elements pointers is not already assigned a value: */
  • issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp

    r9372 r9405  
    2626
    2727        /*Fetch parameters: */
    28         iomodel->constants->FindParam(&dim,DimEnum);
    29         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    30         iomodel->constants->FindParam(&heatcapacity,HeatcapacityEnum);
    31         iomodel->constants->FindParam(&referencetemperature,ReferencetemperatureEnum);
     28        iomodel->Constant(&dim,DimEnum);
     29        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     30        iomodel->Constant(&heatcapacity,HeatcapacityEnum);
     31        iomodel->Constant(&referencetemperature,ReferencetemperatureEnum);
    3232
    3333        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateNodesEnthalpy.cpp

    r9372 r9405  
    2424
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2727       
    2828        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp

    r9372 r9405  
    2020
    2121        /*Fetch parameters: */
    22         iomodel->constants->FindParam(&dim,DimEnum);
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     22        iomodel->Constant(&dim,DimEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2424
    2525        /*Now, is the model 3d? otherwise, do nothing: */
  • issm/trunk/src/c/modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp

    r9372 r9405  
    2424
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2727       
    2828        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp

    r9372 r9405  
    1919       
    2020        /*Fetch data needed: */
    21         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     21        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2222        iomodel->FetchData(1,ElementsEnum);
    2323
  • issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp

    r9372 r9405  
    2222
    2323        /*Fetch parameters: */
    24         iomodel->constants->FindParam(&dim,DimEnum);
    25         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     24        iomodel->Constant(&dim,DimEnum);
     25        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2626
    2727        /*if 2d: Error*/
     
    4040        for (i=0;i<numberofvertices;i++){
    4141                if((iomodel->my_vertices[i]==1)){
    42                         if (iomodel->f(NodeOnBedEnum)[i]){
     42                        if (iomodel->Data(NodeOnBedEnum)[i]){
    4343                                loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,MeltingAnalysisEnum));
    4444                        }
  • issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateNodesMelting.cpp

    r9372 r9405  
    2424       
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2727
    2828        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp

    r9372 r9405  
    2020
    2121        /*Fetch parameters: */
    22         iomodel->constants->FindParam(&dim,DimEnum);
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     22        iomodel->Constant(&dim,DimEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2424
    2525        /*Now, is the model 3d? otherwise, do nothing: */
  • issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp

    r9362 r9405  
    3737
    3838        /*Fetch parameters: */
    39         iomodel->constants->FindParam(&dim,DimEnum);
    40         iomodel->constants->FindParam(&verbose,VerboseEnum);
     39        iomodel->Constant(&dim,DimEnum);
     40        iomodel->Constant(&verbose,VerboseEnum);
    4141       
    4242        SetVerbosityLevel(verbose);
  • issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp

    r9362 r9405  
    4242
    4343        /*Fetch parameters: */
    44         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     44        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    4545
    4646        my_nodes=(bool*)xmalloc(numberofvertices*sizeof(bool));
     
    5757
    5858        /*Fetch parameters: */
    59         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     59        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    6060
    6161        /*each element has it own nodes (as many as vertices) + additional nodes from neighbouring elements for each edge. This yields to a very different partition for
     
    7878
    7979        /*Fetch parameters: */
    80         iomodel->constants->FindParam(&dim,DimEnum);
     80        iomodel->Constant(&dim,DimEnum);
    8181
    8282        /*Build discontinuous node partitioning
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp

    r9362 r9405  
    1313       
    1414        /*Fetch parameters: */
    15         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
     15        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
    1616
    1717        /*Output*/
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp

    r9387 r9405  
    2727       
    2828        /*Fetch parameters: */
    29         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
    30         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    31         iomodel->constants->FindParam(&numberofedges,NumberOfEdgesEnum);
     29        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
     30        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     31        iomodel->Constant(&numberofedges,NumberOfEdgesEnum);
    3232
    3333        /*Recover pointer: */
     
    4747
    4848                        /*Get left and right elements*/
    49                         element=(int)(iomodel->f(EdgesEnum)[4*i+2])-1; //edges are [node1 node2 elem1 elem2]
     49                        element=(int)(iomodel->Data(EdgesEnum)[4*i+2])-1; //edges are [node1 node2 elem1 elem2]
    5050
    5151                        /*Now, if this element is not in the partition, pass: */
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp

    r9383 r9405  
    3030
    3131        /*Fetch parameters: */
    32         iomodel->constants->FindParam(&dim,DimEnum);
    33         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    34         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    35         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
     32        iomodel->Constant(&dim,DimEnum);
     33        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     34        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     35        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
    3636
    3737        /*Recover pointer: */
     
    7272
    7373                                        //Get index of the vertex on which the current node is located
    74                                         vertex_id=(int)*(iomodel->f(ElementsEnum)+3*i+j); //(Matlab indexing)
     74                                        vertex_id=(int)*(iomodel->Data(ElementsEnum)+3*i+j); //(Matlab indexing)
    7575                                        io_index=vertex_id-1;                      //(C indexing)
    7676                                        _assert_(vertex_id>0 && vertex_id<=numberofvertices);
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp

    r9372 r9405  
    2121
    2222        /*Fetch data needed: */
    23         iomodel->constants->FindParam(&dim,DimEnum);
    24         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    25         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
     23        iomodel->Constant(&dim,DimEnum);
     24        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     25        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
    2626        iomodel->FetchData(1,ElementsEnum);
    2727
  • issm/trunk/src/c/modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp

    r9370 r9405  
    2424
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2727
    2828        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/SurfaceSlope/UpdateElementsSurfaceSlope.cpp

    r9370 r9405  
    2020
    2121        /*Fetch data needed: */
    22         iomodel->constants->FindParam(&dim,DimEnum);
    23         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     22        iomodel->Constant(&dim,DimEnum);
     23        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    2424        iomodel->FetchData(1,ElementsEnum);
    2525
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp

    r9362 r9405  
    2323
    2424        /*Fetch parameters: */
    25         iomodel->constants->FindParam(&dim,DimEnum);
     25        iomodel->Constant(&dim,DimEnum);
    2626
    2727        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp

    r9372 r9405  
    2626
    2727        /*Fetch parameters: */
    28         iomodel->constants->FindParam(&dim,DimEnum);
    29         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     28        iomodel->Constant(&dim,DimEnum);
     29        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    3030
    3131        /*Create loads if they do not exist yet*/
     
    4343                /*keep only this partition's nodes:*/
    4444                if((iomodel->my_vertices[i]==1)){
    45                         if (isnan(iomodel->f(SpctemperatureEnum)[i])){ //No penalty applied on spc nodes!
     45                        if (isnan(iomodel->Data(SpctemperatureEnum)[i])){ //No penalty applied on spc nodes!
    4646                                loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,ThermalAnalysisEnum));
    4747                        }
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp

    r9372 r9405  
    2424
    2525        /*Fetch parameters: */
    26         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
     26        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
    2727
    2828        /*Recover pointer: */
  • issm/trunk/src/c/modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp

    r9370 r9405  
    2121
    2222        /*Fetch parameters: */
    23         iomodel->constants->FindParam(&dim,DimEnum);
    24         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    25         iomodel->constants->FindParam(&qmu_analysis,QmuAnalysisEnum);
     23        iomodel->Constant(&dim,DimEnum);
     24        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     25        iomodel->Constant(&qmu_analysis,QmuAnalysisEnum);
    2626
    2727        /*Now, is the model 3d? otherwise, do nothing: */
  • issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp

    r9320 r9405  
    2626        char       *outputfilename          = NULL;
    2727        char        cpu_outputfilename[100];        //easier to convert an integer with sprintf
    28         bool        io_gather;
     28        bool        io_gather,results_on_vertices;
    2929        int         solutiontype;
    3030        Results    *results                 = NULL;
  • issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp

    r9401 r9405  
    493493        else if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum;
    494494        else if (strcmp(name,"NumberOfEdges")==0) return NumberOfEdgesEnum;
     495        else if (strcmp(name,"ResultsOnVertices")==0) return ResultsOnVerticesEnum;
    495496        else _error_("Enum %s not found",name);
    496497
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r9392 r9405  
    5757        /*Checks in debugging mode*/
    5858        /*{{{2*/
    59         _assert_(iomodel->f(UpperelementsEnum));
    60         _assert_(iomodel->f(LowerelementsEnum));
     59        _assert_(iomodel->Data(UpperelementsEnum));
     60        _assert_(iomodel->Data(LowerelementsEnum));
    6161        /*}}}*/
    6262
     
    6666
    6767        /*Build neighbors list*/
    68         if (isnan(iomodel->f(UpperelementsEnum)[index])) penta_elements_ids[1]=this->id; //upper penta is the same penta
    69         else                                    penta_elements_ids[1]=(int)(iomodel->f(UpperelementsEnum)[index]);
    70         if (isnan(iomodel->f(LowerelementsEnum)[index])) penta_elements_ids[0]=this->id; //lower penta is the same penta
    71         else                                    penta_elements_ids[0]=(int)(iomodel->f(LowerelementsEnum)[index]);
     68        if (isnan(iomodel->Data(UpperelementsEnum)[index])) penta_elements_ids[1]=this->id; //upper penta is the same penta
     69        else                                    penta_elements_ids[1]=(int)(iomodel->Data(UpperelementsEnum)[index]);
     70        if (isnan(iomodel->Data(LowerelementsEnum)[index])) penta_elements_ids[0]=this->id; //lower penta is the same penta
     71        else                                    penta_elements_ids[0]=(int)(iomodel->Data(LowerelementsEnum)[index]);
    7272        this->InitHookNeighbors(penta_elements_ids);
    7373
    7474        /*Build horizontalneighborsids list: */
    75         _assert_(iomodel->f(ElementconnectivityEnum));
    76         for(i=0;i<3;i++) this->horizontalneighborsids[i]=(int)iomodel->f(ElementconnectivityEnum)[3*index+i]-1;
     75        _assert_(iomodel->Data(ElementconnectivityEnum));
     76        for(i=0;i<3;i++) this->horizontalneighborsids[i]=(int)iomodel->Data(ElementconnectivityEnum)[3*index+i]-1;
    7777
    7878        //this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
     
    48604860
    48614861        /*Fetch parameters: */
    4862         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    4863         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    4864         iomodel->constants->FindParam(&yts,YtsEnum);
     4862        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     4863        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     4864        iomodel->Constant(&yts,YtsEnum);
    48654865
    48664866        /*Branch on type of vector: nodal or elementary: */
     
    48694869                /*Recover vertices ids needed to initialize inputs*/
    48704870                for(i=0;i<6;i++){
    4871                         penta_vertex_ids[i]=(int)iomodel->f(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
     4871                        penta_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
    48724872                }
    48734873
     
    51695169
    51705170        /*Fetch parameters: */
    5171         iomodel->constants->FindParam(&yts,YtsEnum);
    5172         iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum);
    5173         iomodel->constants->FindParam(&num_control_type,NumControlTypeEnum);
    5174         iomodel->constants->FindParam(&num_cm_responses,NumCmResponsesEnum);
     5171        iomodel->Constant(&yts,YtsEnum);
     5172        iomodel->Constant(&control_analysis,ControlAnalysisEnum);
     5173        iomodel->Constant(&num_control_type,NumControlTypeEnum);
     5174        iomodel->Constant(&num_cm_responses,NumCmResponsesEnum);
    51755175
    51765176        /*Checks if debuging*/
    51775177        /*{{{2*/
    5178         _assert_(iomodel->f(ElementsEnum));
     5178        _assert_(iomodel->Data(ElementsEnum));
    51795179        /*}}}*/
    51805180
    51815181        /*Recover vertices ids needed to initialize inputs*/
    51825182        for(i=0;i<6;i++){
    5183                 penta_vertex_ids[i]=(int)iomodel->f(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
     5183                penta_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
    51845184        }
    51855185
    51865186        /*Control Inputs*/
    5187         if (control_analysis && iomodel->f(ControlTypeEnum)){
     5187        if (control_analysis && iomodel->Data(ControlTypeEnum)){
    51885188                for(i=0;i<num_control_type;i++){
    5189                         switch((int)iomodel->f(ControlTypeEnum)[i]){
     5189                        switch((int)iomodel->Data(ControlTypeEnum)[i]){
    51905190                                case DhdtEnum:
    5191                                         if (iomodel->f(DhdtEnum)){
    5192                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->f(DhdtEnum)[penta_vertex_ids[j]-1]/yts;
    5193                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    5194                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     5191                                        if (iomodel->Data(DhdtEnum)){
     5192                                                for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(DhdtEnum)[penta_vertex_ids[j]-1]/yts;
     5193                                                for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     5194                                                for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    51955195                                                this->inputs->AddInput(new ControlInput(DhdtEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    51965196                                        }
    51975197                                        break;
    51985198                                case VxEnum:
    5199                                         if (iomodel->f(VxEnum)){
    5200                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->f(VxEnum)[penta_vertex_ids[j]-1]/yts;
    5201                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    5202                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     5199                                        if (iomodel->Data(VxEnum)){
     5200                                                for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(VxEnum)[penta_vertex_ids[j]-1]/yts;
     5201                                                for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     5202                                                for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    52035203                                                this->inputs->AddInput(new ControlInput(VxEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    52045204                                        }
    52055205                                        break;
    52065206                                case VyEnum:
    5207                                         if (iomodel->f(VyEnum)){
    5208                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->f(VyEnum)[penta_vertex_ids[j]-1]/yts;
    5209                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    5210                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     5207                                        if (iomodel->Data(VyEnum)){
     5208                                                for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(VyEnum)[penta_vertex_ids[j]-1]/yts;
     5209                                                for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
     5210                                                for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
    52115211                                                this->inputs->AddInput(new ControlInput(VyEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    52125212                                        }
    52135213                                        break;
    52145214                                case DragCoefficientEnum:
    5215                                         if (iomodel->f(DragCoefficientEnum)){
    5216                                                 for(j=0;j<6;j++)nodeinputs[j]=iomodel->f(DragCoefficientEnum)[penta_vertex_ids[j]-1];
    5217                                                 for(j=0;j<6;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    5218                                                 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     5215                                        if (iomodel->Data(DragCoefficientEnum)){
     5216                                                for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(DragCoefficientEnum)[penta_vertex_ids[j]-1];
     5217                                                for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
     5218                                                for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
    52195219                                                this->inputs->AddInput(new ControlInput(DragCoefficientEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    52205220                                        }
     
    52235223                                        /*Matice will take care of it*/ break;
    52245224                                default:
    5225                                         _error_("Control %s not implemented yet",EnumToStringx((int)iomodel->f(ControlTypeEnum)[i]));
     5225                                        _error_("Control %s not implemented yet",EnumToStringx((int)iomodel->Data(ControlTypeEnum)[i]));
    52265226                        }
    52275227                }
     
    52295229
    52305230        //Need to know the type of approximation for this element
    5231         if(iomodel->f(ElementsTypeEnum)){
    5232                 if (*(iomodel->f(ElementsTypeEnum)+index)==MacAyealApproximationEnum){
     5231        if(iomodel->Data(ElementsTypeEnum)){
     5232                if (*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealApproximationEnum){
    52335233                        this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealApproximationEnum));
    52345234                }
    5235                 else if (*(iomodel->f(ElementsTypeEnum)+index)==PattynApproximationEnum){
     5235                else if (*(iomodel->Data(ElementsTypeEnum)+index)==PattynApproximationEnum){
    52365236                        this->inputs->AddInput(new IntInput(ApproximationEnum,PattynApproximationEnum));
    52375237                }
    5238                 else if (*(iomodel->f(ElementsTypeEnum)+index)==MacAyealPattynApproximationEnum){
     5238                else if (*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealPattynApproximationEnum){
    52395239                        this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealPattynApproximationEnum));
    52405240                }
    5241                 else if (*(iomodel->f(ElementsTypeEnum)+index)==HutterApproximationEnum){
     5241                else if (*(iomodel->Data(ElementsTypeEnum)+index)==HutterApproximationEnum){
    52425242                        this->inputs->AddInput(new IntInput(ApproximationEnum,HutterApproximationEnum));
    52435243                }
    5244                 else if (*(iomodel->f(ElementsTypeEnum)+index)==StokesApproximationEnum){
     5244                else if (*(iomodel->Data(ElementsTypeEnum)+index)==StokesApproximationEnum){
    52455245                        this->inputs->AddInput(new IntInput(ApproximationEnum,StokesApproximationEnum));
    52465246                }
    5247                 else if (*(iomodel->f(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){
     5247                else if (*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){
    52485248                        this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealStokesApproximationEnum));
    52495249                }
    5250                 else if (*(iomodel->f(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){
     5250                else if (*(iomodel->Data(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){
    52515251                        this->inputs->AddInput(new IntInput(ApproximationEnum,PattynStokesApproximationEnum));
    52525252                }
    5253                 else if (*(iomodel->f(ElementsTypeEnum)+index)==NoneApproximationEnum){
     5253                else if (*(iomodel->Data(ElementsTypeEnum)+index)==NoneApproximationEnum){
    52545254                        this->inputs->AddInput(new IntInput(ApproximationEnum,NoneApproximationEnum));
    52555255                }
    52565256                else{
    5257                         _error_("Approximation type %s not supported yet",EnumToStringx((int)*(iomodel->f(ElementsTypeEnum)+index)));
     5257                        _error_("Approximation type %s not supported yet",EnumToStringx((int)*(iomodel->Data(ElementsTypeEnum)+index)));
    52585258                }
    52595259        }
    52605260
    52615261        /*DatasetInputs*/
    5262         if (control_analysis && iomodel->f(WeightsEnum)) {
     5262        if (control_analysis && iomodel->Data(WeightsEnum)) {
    52635263
    52645264                /*Create inputs and add to DataSetInput*/
    52655265                DatasetInput* datasetinput=new DatasetInput(WeightsEnum);
    52665266                for(i=0;i<num_cm_responses;i++){
    5267                         for(j=0;j<6;j++)nodeinputs[j]=iomodel->f(WeightsEnum)[(penta_vertex_ids[j]-1)*num_cm_responses+i];
     5267                        for(j=0;j<6;j++)nodeinputs[j]=iomodel->Data(WeightsEnum)[(penta_vertex_ids[j]-1)*num_cm_responses+i];
    52685268                        datasetinput->inputs->AddObject(new PentaVertexInput(WeightsEnum,nodeinputs));
    52695269                }
     
    75207520
    75217521        /*Fetch parameters: */
    7522         iomodel->constants->FindParam(&yts,YtsEnum);
    7523         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
    7524         iomodel->constants->FindParam(&qmu_analysis,QmuAnalysisEnum);
    7525         iomodel->constants->FindParam(&isstokes,IsstokesEnum);
    7526         iomodel->constants->FindParam(&beta,BetaEnum);
    7527         iomodel->constants->FindParam(&heatcapacity,HeatcapacityEnum);
    7528         iomodel->constants->FindParam(&referencetemperature,ReferencetemperatureEnum);
    7529         iomodel->constants->FindParam(&meltingpoint,MeltingpointEnum);
    7530         iomodel->constants->FindParam(&latentheat,LatentheatEnum);
     7522        iomodel->Constant(&yts,YtsEnum);
     7523        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
     7524        iomodel->Constant(&qmu_analysis,QmuAnalysisEnum);
     7525        iomodel->Constant(&isstokes,IsstokesEnum);
     7526        iomodel->Constant(&beta,BetaEnum);
     7527        iomodel->Constant(&heatcapacity,HeatcapacityEnum);
     7528        iomodel->Constant(&referencetemperature,ReferencetemperatureEnum);
     7529        iomodel->Constant(&meltingpoint,MeltingpointEnum);
     7530        iomodel->Constant(&latentheat,LatentheatEnum);
    75317531
    75327532
    75337533        /*Checks if debuging*/
    75347534        /*{{{2*/
    7535         _assert_(iomodel->f(ElementsEnum));
     7535        _assert_(iomodel->Data(ElementsEnum));
    75367536        /*}}}*/
    75377537
     
    75487548
    75497549        /*Recover vertices ids needed to initialize inputs*/
    7550         for(i=0;i<6;i++) penta_vertex_ids[i]=(int)iomodel->f(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
     7550        for(i=0;i<6;i++) penta_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
    75517551
    75527552        /*Recover nodes ids needed to initialize the node hook.*/
     
    75547554                //go recover node ids, needed to initialize the node hook.
    75557555                //WARNING: We assume P1 elements here!!!!!
    7556                 penta_node_ids[i]=iomodel->nodecounter+(int)iomodel->f(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
     7556                penta_node_ids[i]=iomodel->nodecounter+(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab
    75577557        }
    75587558
     
    75697569
    75707570                        /*default vx,vy and vz: either observation or 0 */
    7571                         if(!iomodel->f(VxEnum)){
    7572                                 if (iomodel->f(VxObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->f(VxObsEnum)[penta_vertex_ids[i]-1]/yts;
     7571                        if(!iomodel->Data(VxEnum)){
     7572                                if (iomodel->Data(VxObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->Data(VxObsEnum)[penta_vertex_ids[i]-1]/yts;
    75737573                                else                 for(i=0;i<6;i++)nodeinputs[i]=0;
    75747574                                this->inputs->AddInput(new PentaVertexInput(VxEnum,nodeinputs));
     
    75767576                                if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVxEnum,nodeinputs));
    75777577                        }
    7578                         if(!iomodel->f(VyEnum)){
    7579                                 if (iomodel->f(VyObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->f(VyObsEnum)[penta_vertex_ids[i]-1]/yts;
     7578                        if(!iomodel->Data(VyEnum)){
     7579                                if (iomodel->Data(VyObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->Data(VyObsEnum)[penta_vertex_ids[i]-1]/yts;
    75807580                                else                 for(i=0;i<6;i++)nodeinputs[i]=0;
    75817581                                this->inputs->AddInput(new PentaVertexInput(VyEnum,nodeinputs));
     
    75837583                                if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVyEnum,nodeinputs));
    75847584                        }
    7585                         if(!iomodel->f(VzEnum)){
    7586                                 if (iomodel->f(VzObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->f(VzObsEnum)[penta_vertex_ids[i]-1]/yts;
     7585                        if(!iomodel->Data(VzEnum)){
     7586                                if (iomodel->Data(VzObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->Data(VzObsEnum)[penta_vertex_ids[i]-1]/yts;
    75877587                                else                 for(i=0;i<6;i++)nodeinputs[i]=0;
    75887588                                this->inputs->AddInput(new PentaVertexInput(VzEnum,nodeinputs));
     
    75907590                                if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVzEnum,nodeinputs));
    75917591                        }
    7592                         if(!iomodel->f(PressureEnum)){
     7592                        if(!iomodel->Data(PressureEnum)){
    75937593                                for(i=0;i<6;i++)nodeinputs[i]=0;
    75947594                                if(qmu_analysis){
     
    76017601                                }
    76027602                        }
    7603                         if(*(iomodel->f(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){
     7603                        if(*(iomodel->Data(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){
    76047604                                /*Create VzPattyn and VzStokes Enums*/
    7605                                 if(iomodel->f(VzEnum) && iomodel->f(NodeOnStokesEnum)){
    7606                                         for(i=0;i<6;i++) nodeinputs[i]=iomodel->f(VzEnum)[penta_vertex_ids[i]-1]/yts*iomodel->f(NodeOnStokesEnum)[penta_vertex_ids[i]-1];
     7605                                if(iomodel->Data(VzEnum) && iomodel->Data(NodeOnStokesEnum)){
     7606                                        for(i=0;i<6;i++) nodeinputs[i]=iomodel->Data(VzEnum)[penta_vertex_ids[i]-1]/yts*iomodel->Data(NodeOnStokesEnum)[penta_vertex_ids[i]-1];
    76077607                                        this->inputs->AddInput(new PentaVertexInput(VzStokesEnum,nodeinputs));
    7608                                         for(i=0;i<6;i++) nodeinputs[i]=iomodel->f(VzEnum)[penta_vertex_ids[i]-1]/yts*(1-iomodel->f(NodeOnStokesEnum)[penta_vertex_ids[i]-1]);
     7608                                        for(i=0;i<6;i++) nodeinputs[i]=iomodel->Data(VzEnum)[penta_vertex_ids[i]-1]/yts*(1-iomodel->Data(NodeOnStokesEnum)[penta_vertex_ids[i]-1]);
    76097609                                        this->inputs->AddInput(new PentaVertexInput(VzPattynEnum,nodeinputs));
    76107610                                }
     
    76157615                                }
    76167616                        }
    7617                         if(*(iomodel->f(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){
     7617                        if(*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){
    76187618                                /*Create VzMacAyeal and VzStokes Enums*/
    7619                                 if(iomodel->f(VzEnum) && iomodel->f(NodeOnStokesEnum)){
    7620                                         for(i=0;i<6;i++) nodeinputs[i]=iomodel->f(VzEnum)[penta_vertex_ids[i]-1]/yts*iomodel->f(NodeOnStokesEnum)[penta_vertex_ids[i]-1];
     7619                                if(iomodel->Data(VzEnum) && iomodel->Data(NodeOnStokesEnum)){
     7620                                        for(i=0;i<6;i++) nodeinputs[i]=iomodel->Data(VzEnum)[penta_vertex_ids[i]-1]/yts*iomodel->Data(NodeOnStokesEnum)[penta_vertex_ids[i]-1];
    76217621                                        this->inputs->AddInput(new PentaVertexInput(VzStokesEnum,nodeinputs));
    7622                                         for(i=0;i<6;i++) nodeinputs[i]=iomodel->f(VzEnum)[penta_vertex_ids[i]-1]/yts*(1-iomodel->f(NodeOnStokesEnum)[penta_vertex_ids[i]-1]);
     7622                                        for(i=0;i<6;i++) nodeinputs[i]=iomodel->Data(VzEnum)[penta_vertex_ids[i]-1]/yts*(1-iomodel->Data(NodeOnStokesEnum)[penta_vertex_ids[i]-1]);
    76237623                                        this->inputs->AddInput(new PentaVertexInput(VzMacAyealEnum,nodeinputs));
    76247624                                }
     
    76457645                        this->inputs->AddInput(new PentaVertexInput(VyMeshEnum,nodeinputs));
    76467646                        this->inputs->AddInput(new PentaVertexInput(VzMeshEnum,nodeinputs));
    7647                         if (iomodel->f(TemperatureEnum) && iomodel->f(WaterfractionEnum)) {
     7647                        if (iomodel->Data(TemperatureEnum) && iomodel->Data(WaterfractionEnum)) {
    76487648                                for(i=0;i<6;i++){
    7649                                         if(iomodel->f(TemperatureEnum)[penta_vertex_ids[i]-1] < meltingpoint-beta*iomodel->f(PressureEnum)[penta_vertex_ids[i]-1]){
    7650                                                 nodeinputs[i]=heatcapacity*(iomodel->f(TemperatureEnum)[penta_vertex_ids[i]-1]-referencetemperature);
     7649                                        if(iomodel->Data(TemperatureEnum)[penta_vertex_ids[i]-1] < meltingpoint-beta*iomodel->Data(PressureEnum)[penta_vertex_ids[i]-1]){
     7650                                                nodeinputs[i]=heatcapacity*(iomodel->Data(TemperatureEnum)[penta_vertex_ids[i]-1]-referencetemperature);
    76517651                                        }
    76527652                                        else nodeinputs[i]=heatcapacity*
    7653                                          (meltingpoint-beta*iomodel->f(PressureEnum)[penta_vertex_ids[i]-1]-referencetemperature)
    7654                                                 +latentheat*iomodel->f(WaterfractionEnum)[penta_vertex_ids[i]-1];
     7653                                         (meltingpoint-beta*iomodel->Data(PressureEnum)[penta_vertex_ids[i]-1]-referencetemperature)
     7654                                                +latentheat*iomodel->Data(WaterfractionEnum)[penta_vertex_ids[i]-1];
    76557655                                }
    76567656                                this->inputs->AddInput(new PentaVertexInput(EnthalpyEnum,nodeinputs));
  • issm/trunk/src/c/objects/Elements/PentaHook.cpp

    r9362 r9405  
    5151       
    5252        /*retrieve parameters: */
    53         iomodel->constants->FindParam(&matpar_id,NumberOfElementsEnum); matpar_id++;
     53        iomodel->Constant(&matpar_id,NumberOfElementsEnum); matpar_id++;
    5454
    5555        this->numanalyses=in_numanalyses;
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r9402 r9405  
    5252
    5353                /*Build horizontalneighborsids list: */
    54                 _assert_(iomodel->f(ElementconnectivityEnum));
     54                _assert_(iomodel->Data(ElementconnectivityEnum));
    5555                //for (i=0;i<3;i++) this->horizontalneighborsids[i]=(int)iomodel->elementconnectivity[3*index+i]-1;
    5656
     
    32793279   
    32803280        /*Get parameters: */
    3281         iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum);
    3282         iomodel->constants->FindParam(&num_control_type,NumControlTypeEnum);
    3283         iomodel->constants->FindParam(&yts,YtsEnum);
    3284         iomodel->constants->FindParam(&num_cm_responses,NumCmResponsesEnum);
     3281        iomodel->Constant(&control_analysis,ControlAnalysisEnum);
     3282        iomodel->Constant(&num_control_type,NumControlTypeEnum);
     3283        iomodel->Constant(&yts,YtsEnum);
     3284        iomodel->Constant(&num_cm_responses,NumCmResponsesEnum);
    32853285
    32863286        /*Recover vertices ids needed to initialize inputs*/
    32873287        for(i=0;i<3;i++){
    3288                 tria_vertex_ids[i]=(int)iomodel->f(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
     3288                tria_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
    32893289        }
    32903290
    32913291        /*Control Inputs*/
    3292         if (control_analysis && iomodel->f(ControlTypeEnum)){
     3292        if (control_analysis && iomodel->Data(ControlTypeEnum)){
    32933293                for(i=0;i<num_control_type;i++){
    3294                         switch((int)iomodel->f(ControlTypeEnum)[i]){
     3294                        switch((int)iomodel->Data(ControlTypeEnum)[i]){
    32953295                                case DhdtEnum:
    3296                                         if (iomodel->f(DhdtEnum)){
    3297                                                 for(j=0;j<3;j++)nodeinputs[j]=iomodel->f(DhdtEnum)[tria_vertex_ids[j]-1]/yts;
    3298                                                 for(j=0;j<3;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    3299                                                 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
     3296                                        if (iomodel->Data(DhdtEnum)){
     3297                                                for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(DhdtEnum)[tria_vertex_ids[j]-1]/yts;
     3298                                                for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
     3299                                                for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    33003300                                                this->inputs->AddInput(new ControlInput(DhdtEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    33013301                                        }
    33023302                                        break;
    33033303                                case VxEnum:
    3304                                         if (iomodel->f(VxEnum)){
    3305                                                 for(j=0;j<3;j++)nodeinputs[j]=iomodel->f(VxEnum)[tria_vertex_ids[j]-1]/yts;
    3306                                                 for(j=0;j<3;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    3307                                                 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
     3304                                        if (iomodel->Data(VxEnum)){
     3305                                                for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(VxEnum)[tria_vertex_ids[j]-1]/yts;
     3306                                                for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
     3307                                                for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    33083308                                                this->inputs->AddInput(new ControlInput(VxEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    33093309                                        }
    33103310                                        break;
    33113311                                case VyEnum:
    3312                                         if (iomodel->f(VyEnum)){
    3313                                                 for(j=0;j<3;j++)nodeinputs[j]=iomodel->f(VyEnum)[tria_vertex_ids[j]-1]/yts;
    3314                                                 for(j=0;j<3;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    3315                                                 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
     3312                                        if (iomodel->Data(VyEnum)){
     3313                                                for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(VyEnum)[tria_vertex_ids[j]-1]/yts;
     3314                                                for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
     3315                                                for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    33163316                                                this->inputs->AddInput(new ControlInput(VyEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    33173317                                        }
    33183318                                        break;
    33193319                                case DragCoefficientEnum:
    3320                                         if (iomodel->f(DragCoefficientEnum)){
    3321                                                 for(j=0;j<3;j++)nodeinputs[j]=iomodel->f(DragCoefficientEnum)[tria_vertex_ids[j]-1];
    3322                                                 for(j=0;j<3;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
    3323                                                 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
     3320                                        if (iomodel->Data(DragCoefficientEnum)){
     3321                                                for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(DragCoefficientEnum)[tria_vertex_ids[j]-1];
     3322                                                for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
     3323                                                for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
    33243324                                                this->inputs->AddInput(new ControlInput(DragCoefficientEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    33253325                                        }
     
    33283328                                        /*Matice will take care of it*/ break;
    33293329                                default:
    3330                                         _error_("Control %s not implemented yet",EnumToStringx((int)iomodel->f(ControlTypeEnum)[i]));
     3330                                        _error_("Control %s not implemented yet",EnumToStringx((int)iomodel->Data(ControlTypeEnum)[i]));
    33313331                        }
    33323332                }
     
    33343334
    33353335        /*DatasetInputs*/
    3336         if (control_analysis && iomodel->f(WeightsEnum)){
     3336        if (control_analysis && iomodel->Data(WeightsEnum)){
    33373337
    33383338                /*Create inputs and add to DataSetInput*/
    33393339                DatasetInput* datasetinput=new DatasetInput(WeightsEnum);
    33403340                for(i=0;i<num_cm_responses;i++){
    3341                         for(j=0;j<3;j++)nodeinputs[j]=iomodel->f(WeightsEnum)[(tria_vertex_ids[j]-1)*num_cm_responses+i];
     3341                        for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(WeightsEnum)[(tria_vertex_ids[j]-1)*num_cm_responses+i];
    33423342                        datasetinput->inputs->AddObject(new TriaVertexInput(WeightsEnum,nodeinputs));
    33433343                }
     
    39063906
    39073907        /*Fetch parameters: */
    3908         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    3909         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    3910         iomodel->constants->FindParam(&yts,YtsEnum);
     3908        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     3909        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     3910        iomodel->Constant(&yts,YtsEnum);
    39113911
    39123912        /*Branch on type of vector: nodal or elementary: */
     
    39153915                /*Recover vertices ids needed to initialize inputs*/
    39163916                for(i=0;i<3;i++){
    3917                         tria_vertex_ids[i]=(int)iomodel->f(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
     3917                        tria_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
    39183918                }
    39193919
     
    52235223        /*Checks if debuging*/
    52245224        /*{{{2*/
    5225         _assert_(iomodel->f(ElementsEnum));
     5225        _assert_(iomodel->Data(ElementsEnum));
    52265226        /*}}}*/
    52275227
    52285228        /*Fetch parameters: */
    5229         iomodel->constants->FindParam(&yts,YtsEnum);
    5230         iomodel->constants->FindParam(&prognostic_DG,PrognosticDGEnum);
    5231         iomodel->constants->FindParam(&qmu_analysis,QmuAnalysisEnum);
     5229        iomodel->Constant(&yts,YtsEnum);
     5230        iomodel->Constant(&prognostic_DG,PrognosticDGEnum);
     5231        iomodel->Constant(&qmu_analysis,QmuAnalysisEnum);
    52325232
    52335233        /*Recover element type*/
     
    52445244        /*Recover vertices ids needed to initialize inputs*/
    52455245        for(i=0;i<3;i++){
    5246                 tria_vertex_ids[i]=(int)iomodel->f(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
     5246                tria_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
    52475247        }
    52485248
     
    52575257                /*Continuous Galerkin*/
    52585258                for(i=0;i<3;i++){
    5259                         tria_node_ids[i]=iomodel->nodecounter+(int)*(iomodel->f(ElementsEnum)+3*index+i); //ids for vertices are in the elements array from Matlab
     5259                        tria_node_ids[i]=iomodel->nodecounter+(int)*(iomodel->Data(ElementsEnum)+3*index+i); //ids for vertices are in the elements array from Matlab
    52605260                }
    52615261        }
     
    52735273
    52745274                        /*default vx,vy and vz: either observation or 0 */
    5275                         if(!iomodel->f(VxEnum)){
    5276                                 if (iomodel->f(VxObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->f(VxObsEnum)[tria_vertex_ids[i]-1]/yts;
     5275                        if(!iomodel->Data(VxEnum)){
     5276                                if (iomodel->Data(VxObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->Data(VxObsEnum)[tria_vertex_ids[i]-1]/yts;
    52775277                                else                 for(i=0;i<3;i++)nodeinputs[i]=0;
    52785278                                this->inputs->AddInput(new TriaVertexInput(VxEnum,nodeinputs));
     
    52805280                                if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVxEnum,nodeinputs));
    52815281                        }
    5282                         if(!iomodel->f(VyEnum)){
    5283                                 if (iomodel->f(VyObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->f(VyObsEnum)[tria_vertex_ids[i]-1]/yts;
     5282                        if(!iomodel->Data(VyEnum)){
     5283                                if (iomodel->Data(VyObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->Data(VyObsEnum)[tria_vertex_ids[i]-1]/yts;
    52845284                                else                 for(i=0;i<3;i++)nodeinputs[i]=0;
    52855285                                this->inputs->AddInput(new TriaVertexInput(VyEnum,nodeinputs));
     
    52875287                                if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVyEnum,nodeinputs));
    52885288                        }
    5289                         if(!iomodel->f(VzEnum)){
    5290                                 if (iomodel->f(VzObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->f(VzObsEnum)[tria_vertex_ids[i]-1]/yts;
     5289                        if(!iomodel->Data(VzEnum)){
     5290                                if (iomodel->Data(VzObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->Data(VzObsEnum)[tria_vertex_ids[i]-1]/yts;
    52915291                                else                 for(i=0;i<3;i++)nodeinputs[i]=0;
    52925292                                this->inputs->AddInput(new TriaVertexInput(VzEnum,nodeinputs));
     
    52945294                                if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVzEnum,nodeinputs));
    52955295                        }
    5296                         if(!iomodel->f(PressureEnum)){
     5296                        if(!iomodel->Data(PressureEnum)){
    52975297                                for(i=0;i<3;i++)nodeinputs[i]=0;
    52985298                                if(qmu_analysis){
  • issm/trunk/src/c/objects/Elements/TriaHook.cpp

    r9362 r9405  
    4949
    5050        /*retrieve parameters: */
    51         iomodel->constants->FindParam(&matpar_id,NumberOfElementsEnum); matpar_id++;
     51        iomodel->Constant(&matpar_id,NumberOfElementsEnum); matpar_id++;
    5252       
    5353        this->numanalyses=in_numanalyses;
  • issm/trunk/src/c/objects/IoModel.cpp

    r9393 r9405  
    4646        /*Initialize and read constants:*/
    4747        this->constants=new Parameters();
    48         this->FetchParameters(this->constants); /*this routine goes through the input file, and fetches bools, ints, doubles and strings only, nothing memory intensive*/
     48        this->FetchConstants(); /*this routine goes through the input file, and fetches bools, ints, doubles and strings only, nothing memory intensive*/
    4949
    5050        /*Initialize data: */
     
    6262        this->loadcounter=0;
    6363        this->constraintcounter=0;
    64 
    6564}
    6665/*}}}*/
     
    7170
    7271        /*Some checks in debugging mode*/
    73 #ifdef _ISSM_DEBUG_
     72        #ifdef _ISSM_DEBUG_
    7473        for(int i=0;i<MaximumNumberOfEnums;i++){
    7574                if(this->data[i]){
     
    7776                }
    7877        }
    79 #endif
     78        #endif
    8079
    8180        xfree((void**)&this->data);
     
    8887}
    8988/*}}}*/
    90 /*FUNCTION IoModel::FetchData(bool*     pbool,int data_enum){{{1*/
    91 void  IoModel::FetchData(bool* pboolean,int data_enum){
    92 
    93         extern int my_rank;
    94         extern int num_procs;
    95        
    96 
    97         /*output: */
    98         int   booleanint;
    99         int   code;
    100        
    101         /*Set file pointer to beginning of the data: */
    102         fid=this->SetFilePointerToData(&code,NULL,data_enum);
    103 
    104         if(code!=1)_error_("expecting a boolean for enum %s",EnumToStringx(data_enum));
    105        
    106         /*We have to read a boolean from disk. */
    107         if(my_rank==0){ 
    108                 if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_(" could not read boolean ");
    109         }
    110         MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
    111 
    112         /*cast to bool: */
    113         /*Assign output pointers: */
    114         *pboolean=(bool)booleanint;
    115 
    116 }
    117 /*}}}*/
    118 /*FUNCTION IoModel::FetchData(int*      pinteger,int data_enum){{{1*/
    119 void  IoModel::FetchData(int* pinteger,int data_enum){
    120 
    121         extern int my_rank;
    122         extern int num_procs;
    123        
    124 
    125         /*output: */
    126         int   integer;
    127         int   code;
    128        
    129         /*Set file pointer to beginning of the data: */
    130         fid=this->SetFilePointerToData(&code,NULL,data_enum);
    131        
    132         if(code!=2)_error_("expecting an integer for enum %s",EnumToStringx(data_enum));
    133        
    134         /*We have to read a integer from disk. First read the dimensions of the integer, then the integer: */
    135         if(my_rank==0){ 
    136                 if(fread(&integer,sizeof(int),1,fid)!=1) _error_(" could not read integer ");
    137         }
    138 
    139         MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
    140 
    141         /*Assign output pointers: */
    142         *pinteger=integer;
    143 
    144 }
    145 /*}}}*/
    146 /*FUNCTION IoModel::FetchData(double*   pscalar,int data_enum){{{1*/
    147 void  IoModel::FetchData(double* pscalar,int data_enum){
    148 
    149 
    150         extern int my_rank;
    151         extern int num_procs;
    152        
    153 
    154         /*output: */
    155         double   scalar;
    156         int      code;
    157        
    158         /*Set file pointer to beginning of the data: */
    159         fid=this->SetFilePointerToData(&code,NULL,data_enum);
    160        
    161         if(code!=3)_error_("expecting a double for enum %s",EnumToStringx(data_enum));
    162        
    163         /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */
    164         if(my_rank==0){
    165                 if(fread(&scalar,sizeof(double),1,fid)!=1)_error_(" could not read scalar ");
    166         }
    167         MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    168 
    169         /*Assign output pointers: */
    170         *pscalar=scalar;
    171                  
    172 }
    173 /*}}}*/
    174 /*FUNCTION IoModel::FetchData(char**    pstring,int data_enum){{{1*/
    175 void  IoModel::FetchData(char** pstring,int data_enum){
    176 
    177         extern int my_rank;
    178         extern int num_procs;
    179        
    180 
    181         /*output: */
    182         char* string=NULL;
    183         int   string_size;
    184         int code=0;
    185        
    186         /*Set file pointer to beginning of the data: */
    187         fid=this->SetFilePointerToData(&code,NULL,data_enum);
    188        
    189         if(code!=4)_error_("expecting a string for enum %s",EnumToStringx(data_enum));
    190        
    191         /*Now fetch: */
    192        
    193         /*We have to read a string from disk. First read the dimensions of the string, then the string: */
    194         if(my_rank==0){ 
    195                 if(fread(&string_size,sizeof(int),1,fid)!=1) _error_(" could not read length of string ");
    196         }
    197 
    198         MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
    199 
    200         /*Now allocate string: */
    201         if(string_size){
    202                 string=(char*)xmalloc((string_size+1)*sizeof(char));
    203                 string[string_size]='\0';
    204 
    205                 /*Read string on node 0, then broadcast: */
    206                 if(my_rank==0){ 
    207                         if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
    208                 }
    209                 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
    210         }
    211         else{
    212                 string=(char*)xmalloc(sizeof(char));
    213                 string[0]='\0';
    214         }
    215 
    216 
    217         /*Assign output pointers: */
    218         *pstring=string;
    219 }
    220 /*}}}*/
    221 /*FUNCTION IoModel::FetchData(int**  pintegerematrix,int* pM,int* pN,int data_enum){{{1*/
    222 void  IoModel::FetchData(int** pmatrix,int* pM,int* pN,int data_enum){
    223 
    224         extern int my_rank;
    225         extern int num_procs;
    226         int i,j;
    227 
    228         /*output: */
    229         int M,N;
    230         double* matrix=NULL;
    231         int*    integer_matrix=NULL;
    232         int code=0;
    233         int vector_type=0;
    234        
    235        
    236         /*Set file pointer to beginning of the data: */
    237         fid=this->SetFilePointerToData(&code,&vector_type,data_enum);
    238 
    239         if((code!=5) && (code!=6) && (code!=7))_error_("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum));
    240        
    241         /*Now fetch: */
    242 
    243         /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
    244         /*numberofelements: */
    245         if(my_rank==0){ 
    246                 if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    247         }
    248 
    249         MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
    250 
    251         if(my_rank==0){ 
    252                 if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    253         }
    254         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
    255 
    256         /*Now allocate matrix: */
    257         if(M*N){
    258                 matrix=(double*)xmalloc(M*N*sizeof(double));
    259 
    260                 /*Read matrix on node 0, then broadcast: */
    261                 if(my_rank==0){ 
    262                         if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
    263                 }
    264                
    265                 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
    266         }
    267 
    268         /*Now cast to integer: */
    269         if(M*N){
    270                 integer_matrix=(int*)xmalloc(M*N*sizeof(int));
    271                 for (i=0;i<M;i++){
    272                         for (j=0;j<N;j++){
    273                                 integer_matrix[i*N+j]=(int)matrix[i*N+j];
    274                         }
    275                 }
    276         }
    277         else{
    278                 integer_matrix=NULL;
    279         }
    280         /*Free ressources:*/
    281         xfree((void**)&matrix);
    282 
    283         /*Assign output pointers: */
    284         *pmatrix=integer_matrix;
    285         if (pM)*pM=M;
    286         if (pN)*pN=N;
    287 
    288 }
    289 /*}}}*/
    290 /*FUNCTION IoModel::FetchData(double**  pdoublematrix,int* pM,int* pN,int data_enum){{{1*/
    291 void  IoModel::FetchData(double** pmatrix,int* pM,int* pN,int data_enum){
    292 
    293         extern int my_rank;
    294         extern int num_procs;
    295 
    296         /*output: */
    297         int M,N;
    298         double* matrix=NULL;
    299         int code=0;
    300         int vector_type=0;
    301        
    302         /*Set file pointer to beginning of the data: */
    303         fid=this->SetFilePointerToData(&code,&vector_type,data_enum);
    304         if((code!=5) && (code!=6) && (code!=7))_error_("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum));
    305        
    306         /*Now fetch: */
    307 
    308         /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
    309         /*numberofelements: */
    310         if(my_rank==0){ 
    311                 if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    312         }
    313         MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
    314 
    315         if(my_rank==0){ 
    316                 if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    317         }
    318         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
    319 
    320         /*Now allocate matrix: */
    321         if(M*N){
    322                 matrix=(double*)xmalloc(M*N*sizeof(double));
    323 
    324                 /*Read matrix on node 0, then broadcast: */
    325                 if(my_rank==0){ 
    326                         if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
    327                 }
    328                 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
    329         }
    330 
    331         /*Assign output pointers: */
    332         *pmatrix=matrix;
    333         if (pM)*pM=M;
    334         if (pN)*pN=N;
    335 }
    336 /*}}}*/
    337 /*FUNCTION IoModel::FetchData(char***   pstrings,int* pnumstrings,int data_enum){{{1*/
    338 void  IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){
    339 
    340         extern int my_rank;
    341         extern int num_procs;
    342        
    343         int i;
    344 
    345         /*output: */
    346         int   numstrings=0;
    347         char** strings=NULL;
    348        
    349         /*intermediary: */
    350         char* string=NULL;
    351         int   string_size;
    352         int   code;
    353        
    354         /*Set file pointer to beginning of the data: */
    355         fid=this->SetFilePointerToData(&code,NULL,data_enum);
    356        
    357         if(code!=9)_error_("expecting a string array for enum %s",EnumToStringx(data_enum));
    358        
    359         /*We have to read a bunch of strings from disk. First read the number of strings, and allocate: */
    360         if(my_rank==0){ 
    361                 if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_(" could not read length of string array");
    362         }
    363         MPI_Bcast(&numstrings,1,MPI_INT,0,MPI_COMM_WORLD);
    364 
    365         /*Now allocate string array: */
    366         if(numstrings){
    367                 strings=(char**)xmalloc(numstrings*sizeof(char*));
    368                 for(i=0;i<numstrings;i++)strings[i]=NULL;
    369 
    370                 /*Go through strings, and read: */
    371                 for(i=0;i<numstrings;i++){
    372                        
    373                         if(my_rank==0){ 
    374                                 if(fread(&string_size,sizeof(int),1,fid)!=1) _error_(" could not read length of string ");
    375                         }
    376                         MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
    377                         if(string_size){
    378                                 string=(char*)xmalloc((string_size+1)*sizeof(char));
    379                                 string[string_size]='\0';
    380 
    381                                 /*Read string on node 0, then broadcast: */
    382                                 if(my_rank==0){ 
    383                                         if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
    384                                 }
    385                                 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
    386                         }
    387                         else{
    388                                 string=(char*)xmalloc(sizeof(char));
    389                                 string[0]='\0';
    390                         }
    391 
    392                         strings[i]=string;
    393                 }
    394         }
    395 
    396         /*Assign output pointers: */
    397         *pstrings=strings;
    398         *pnumstrings=numstrings;
    399 }
    400 /*}}}*/
    401 /*FUNCTION IoModel::FetchData(double*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{1*/
    402 void  IoModel::FetchData(double*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){
    403 
    404         int i;
    405 
    406         extern int my_rank;
    407         extern int num_procs;
    408 
    409         /*output: */
    410         double** matrices=NULL;
    411         int*     mdims=NULL;
    412         int*     ndims=NULL;
    413         int      numrecords=0;
    414 
    415         /*intermediary: */
    416         int     M, N;
    417         double *matrix = NULL;
    418         int     code;
    419        
    420         /*Set file pointer to beginning of the data: */
    421         fid=this->SetFilePointerToData(&code,NULL,data_enum);
    422         if(code!=8)_error_("expecting a double mat array for enum %s",EnumToStringx(data_enum));
    423        
    424         /*Now fetch: */
    425         if(my_rank==0){ 
    426                 if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
    427         }
    428         MPI_Bcast(&numrecords,1,MPI_INT,0,MPI_COMM_WORLD);
    429 
    430         if(numrecords){
    431 
    432                 /*Allocate matrices :*/
    433                 matrices=(double**)xmalloc(numrecords*sizeof(double*));
    434                 mdims=(int*)xmalloc(numrecords*sizeof(int));
    435                 ndims=(int*)xmalloc(numrecords*sizeof(int));
    436 
    437                 for(i=0;i<numrecords;i++){
    438                         matrices[i]=NULL;
    439                         mdims[i]=0;
    440                         ndims[i]=0;
    441                 }
    442 
    443                 /*Loop through records and fetch matrix: */
    444                 for(i=0;i<numrecords;i++){
    445 
    446                         if(my_rank==0){ 
    447                                 if(fread(&M,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of rows in ",i,"th matrix of matrix array");
    448                         }
    449                         MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
    450 
    451                         if(my_rank==0){ 
    452                                 if(fread(&N,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of columns in ",i,"th matrix of matrix array");
    453                         }
    454                         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
    455 
    456                         /*Now allocate matrix: */
    457                         if(M*N){
    458                                 matrix=(double*)xmalloc(M*N*sizeof(double));
    459 
    460                                 /*Read matrix on node 0, then broadcast: */
    461                                 if(my_rank==0){ 
    462                                         if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
    463                                 }
    464 
    465                                 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
    466                         }
    467 
    468                         /*Assign: */
    469                         matrices[i]=matrix;
    470                         mdims[i]=M;
    471                         ndims[i]=N;
    472                 }
    473         }
    474 
    475         /*Assign output pointers: */
    476         *pmatrices=matrices;
    477         *pmdims=mdims;
    478         *pndims=ndims;
    479         *pnumrecords=numrecords;
    480 }
    481 /*}}}*/
    482 /*FUNCTION IoModel::FetchData(int num,...){{{1*/
    483 void  IoModel::FetchData(int num,...){
    484 
    485         va_list ap;
    486         int     dataenum;
    487         double* matrix=NULL;
    488         int     M,N;
    489         int     i;
    490 
    491         /*Go through the entire list of enums and fetch the corresponding data. Add it to the iomodel->data dataset. Everything
    492          *we fetch is a double* : */
    493        
    494         va_start(ap,num);
    495         for(i=0; i<num; i++){
    496                
    497                 dataenum=va_arg(ap, int);
    498 
    499                 /*Some checks in debugging mode*/
    500                 /*{{{*/
    501                 #ifdef _ISSM_DEBUG_
    502                 _assert_(dataenum<MaximumNumberOfEnums);
    503                 if(this->data[dataenum]){
    504                         _error_("Info: trying to fetch %s but previous pointer has not been freed (DeleteData has not been called)",EnumToStringx(dataenum));
    505                 }
    506                 #endif
    507                 /*}}}*/
    508 
    509                 /*Add to this->data: */
    510                 this->FetchData(&matrix,&M,&N,dataenum);
    511                 this->data[dataenum]=matrix;
    512         }
    513         va_end(ap);
    514 
    515 }
    516 /*}}}*/
    517 /*FUNCTION IoModel::DeleteData(int num,...){{{1*/
     89
     90/*FUNCTION IoModel::Constant(bool* poutput,int constant_enum){{{1*/
     91void IoModel::Constant(bool* poutput,int constant_enum){
     92
     93        _assert_(constant_enum>=0);
     94        _assert_(this->constants);
     95
     96        this->constants->FindParam(poutput,constant_enum);
     97}
     98/*}}}*/
     99/*FUNCTION IoModel::Constant(int* poutput,int constant_enum){{{1*/
     100void IoModel::Constant(int* poutput,int constant_enum){
     101
     102        _assert_(constant_enum>=0);
     103        _assert_(this->constants);
     104
     105        this->constants->FindParam(poutput,constant_enum);
     106}
     107/*}}}*/
     108/*FUNCTION IoModel::Constant(double* poutput,int constant_enum){{{1*/
     109void IoModel::Constant(double* poutput,int constant_enum){
     110
     111        _assert_(constant_enum>=0);
     112        _assert_(this->constants);
     113
     114        this->constants->FindParam(poutput,constant_enum);
     115}
     116/*}}}*/
     117/*FUNCTION IoModel::CopyConstants{{{1*/
     118Parameters* IoModel::CopyConstants(void){
     119
     120        _assert_(this->constants);
     121        return (Parameters*)this->constants->Copy();
     122}
     123/*}}}*/
     124/*FUNCTION IoModel::Data{{{1*/
     125double* IoModel::Data(int data_enum){
     126
     127        _assert_(data_enum<MaximumNumberOfEnums);
     128        _assert_(data_enum>=0);
     129
     130        return this->data[data_enum];
     131}
     132/*}}}*/
     133/*FUNCTION IoModel::DeleteData{{{1*/
    518134void  IoModel::DeleteData(int num,...){
    519135
     
    524140
    525141        /*Go through the entire list of enums and delete the corresponding data from the iomodel-data dataset: */
    526        
     142
    527143        va_start(ap,num);
    528144        for(i = 0; i <num; i++){
     
    533149        va_end(ap);
    534150} /*}}}*/
    535 /*FUNCTION IoModel::f(int dataenum){{{1*/
    536 double* IoModel::f(int dataenum){
    537 
    538         _assert_(dataenum<MaximumNumberOfEnums);
    539         return this->data[dataenum];
    540 }
    541 /*}}}*/
    542 /*FUNCTION IoModel::FetchParameters(Parameters* parameters){{{1*/
    543 void  IoModel::FetchParameters(Parameters* parameters){
     151/*FUNCTION IoModel::FetchConstants{{{1*/
     152void  IoModel::FetchConstants(void){
    544153
    545154        extern int my_rank;
     
    558167        int   string_size;
    559168
    560  
     169        /*Check that some fields have been allocated*/
     170        _assert_(this->fid);
     171        _assert_(this->constants);
     172
    561173        /*Go find in the binary file, the position of the data we want to fetch: */
    562174        if(my_rank==0){ //cpu 0{{{2
     
    595207
    596208                                                /*create BoolParam: */
    597                                                 parameters->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to boolean
     209                                                this->constants->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to boolean
    598210
    599211                                                break;
     
    604216
    605217                                                /*create IntParam: */
    606                                                 parameters->AddObject(new IntParam(record_enum,integer));
     218                                                this->constants->AddObject(new IntParam(record_enum,integer));
    607219
    608220                                                break;
     
    613225
    614226                                                /*create DoubleParam: */
    615                                                 parameters->AddObject(new DoubleParam(record_enum,scalar));
     227                                                this->constants->AddObject(new DoubleParam(record_enum,scalar));
    616228
    617229                                                break;
     
    635247                                               
    636248                                                /*Add string to parameters: */
    637                                                 parameters->AddObject(new StringParam(record_enum,string));
     249                                                this->constants->AddObject(new StringParam(record_enum,string));
    638250
    639251                                                /*Free string*/
     
    696308                                               
    697309                                        /*create BoolParam: */
    698                                         parameters->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to a boolean
     310                                        this->constants->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to a boolean
    699311                                        break;
    700312
     
    704316                                               
    705317                                        /*create IntParam: */
    706                                         parameters->AddObject(new IntParam(record_enum,integer));
     318                                        this->constants->AddObject(new IntParam(record_enum,integer));
    707319
    708320                                        break;
     
    712324                                               
    713325                                        /*create DoubleParam: */
    714                                         parameters->AddObject(new DoubleParam(record_enum,scalar));
     326                                        this->constants->AddObject(new DoubleParam(record_enum,scalar));
    715327
    716328                                        break;
     
    729341                                        }
    730342                                        /*Add string to parameters: */
    731                                         parameters->AddObject(new StringParam(record_enum,string));
     343                                        this->constants->AddObject(new StringParam(record_enum,string));
    732344
    733345                                        break;
     
    749361}
    750362/*}}}*/
    751 /*FUNCTION IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){{{1*/
    752 FILE* IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){
     363/*FUNCTION IoModel::FetchData(bool*     pbool,int data_enum){{{1*/
     364void  IoModel::FetchData(bool* pboolean,int data_enum){
    753365
    754366        extern int my_rank;
    755367        extern int num_procs;
    756368       
    757         int found=0;
    758         int record_enum;
    759         int record_length;
    760         int record_code; //1 to 7 number
    761         int vector_type; //nodal or elementary
    762  
    763         /*Go find in the binary file, the position of the data we want to fetch: */
     369
     370        /*output: */
     371        int   booleanint;
     372        int   code;
     373       
     374        /*Set file pointer to beginning of the data: */
     375        fid=this->SetFilePointerToData(&code,NULL,data_enum);
     376
     377        if(code!=1)_error_("expecting a boolean for enum %s",EnumToStringx(data_enum));
     378       
     379        /*We have to read a boolean from disk. */
     380        if(my_rank==0){ 
     381                if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_(" could not read boolean ");
     382        }
     383        MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     384
     385        /*cast to bool: */
     386        /*Assign output pointers: */
     387        *pboolean=(bool)booleanint;
     388
     389}
     390/*}}}*/
     391/*FUNCTION IoModel::FetchData(int*      pinteger,int data_enum){{{1*/
     392void  IoModel::FetchData(int* pinteger,int data_enum){
     393
     394        extern int my_rank;
     395        extern int num_procs;
     396       
     397
     398        /*output: */
     399        int   integer;
     400        int   code;
     401       
     402        /*Set file pointer to beginning of the data: */
     403        fid=this->SetFilePointerToData(&code,NULL,data_enum);
     404       
     405        if(code!=2)_error_("expecting an integer for enum %s",EnumToStringx(data_enum));
     406       
     407        /*We have to read a integer from disk. First read the dimensions of the integer, then the integer: */
     408        if(my_rank==0){ 
     409                if(fread(&integer,sizeof(int),1,fid)!=1) _error_(" could not read integer ");
     410        }
     411
     412        MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     413
     414        /*Assign output pointers: */
     415        *pinteger=integer;
     416
     417}
     418/*}}}*/
     419/*FUNCTION IoModel::FetchData(double*   pscalar,int data_enum){{{1*/
     420void  IoModel::FetchData(double* pscalar,int data_enum){
     421
     422
     423        extern int my_rank;
     424        extern int num_procs;
     425       
     426
     427        /*output: */
     428        double   scalar;
     429        int      code;
     430       
     431        /*Set file pointer to beginning of the data: */
     432        fid=this->SetFilePointerToData(&code,NULL,data_enum);
     433       
     434        if(code!=3)_error_("expecting a double for enum %s",EnumToStringx(data_enum));
     435       
     436        /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */
    764437        if(my_rank==0){
    765        
    766                 /*First set FILE* position to the beginning of the file: */
    767                 fseek(fid,0,SEEK_SET);
    768 
    769                 /*Now march through file looking for the correct data identifier: */
    770                 for(;;){
    771                         /*Read enum for this size of first string name: */
    772                         if(fread(&record_enum,sizeof(int),1,fid)==0){
    773                                 /*Ok, we have reached the end of the file. break: */
    774                                 found=0;
    775                                 break;
    776                         }
     438                if(fread(&scalar,sizeof(double),1,fid)!=1)_error_(" could not read scalar ");
     439        }
     440        MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     441
     442        /*Assign output pointers: */
     443        *pscalar=scalar;
     444                 
     445}
     446/*}}}*/
     447/*FUNCTION IoModel::FetchData(char**    pstring,int data_enum){{{1*/
     448void  IoModel::FetchData(char** pstring,int data_enum){
     449
     450        extern int my_rank;
     451        extern int num_procs;
     452       
     453
     454        /*output: */
     455        char* string=NULL;
     456        int   string_size;
     457        int code=0;
     458       
     459        /*Set file pointer to beginning of the data: */
     460        fid=this->SetFilePointerToData(&code,NULL,data_enum);
     461       
     462        if(code!=4)_error_("expecting a string for enum %s",EnumToStringx(data_enum));
     463       
     464        /*Now fetch: */
     465       
     466        /*We have to read a string from disk. First read the dimensions of the string, then the string: */
     467        if(my_rank==0){ 
     468                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_(" could not read length of string ");
     469        }
     470
     471        MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     472
     473        /*Now allocate string: */
     474        if(string_size){
     475                string=(char*)xmalloc((string_size+1)*sizeof(char));
     476                string[string_size]='\0';
     477
     478                /*Read string on node 0, then broadcast: */
     479                if(my_rank==0){ 
     480                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
     481                }
     482                MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     483        }
     484        else{
     485                string=(char*)xmalloc(sizeof(char));
     486                string[0]='\0';
     487        }
     488
     489
     490        /*Assign output pointers: */
     491        *pstring=string;
     492}
     493/*}}}*/
     494/*FUNCTION IoModel::FetchData(int**  pintegerematrix,int* pM,int* pN,int data_enum){{{1*/
     495void  IoModel::FetchData(int** pmatrix,int* pM,int* pN,int data_enum){
     496
     497        extern int my_rank;
     498        extern int num_procs;
     499        int i,j;
     500
     501        /*output: */
     502        int M,N;
     503        double* matrix=NULL;
     504        int*    integer_matrix=NULL;
     505        int code=0;
     506        int vector_type=0;
     507       
     508       
     509        /*Set file pointer to beginning of the data: */
     510        fid=this->SetFilePointerToData(&code,&vector_type,data_enum);
     511
     512        if((code!=5) && (code!=6) && (code!=7))_error_("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum));
     513       
     514        /*Now fetch: */
     515
     516        /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
     517        /*numberofelements: */
     518        if(my_rank==0){ 
     519                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
     520        }
     521
     522        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     523
     524        if(my_rank==0){ 
     525                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
     526        }
     527        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     528
     529        /*Now allocate matrix: */
     530        if(M*N){
     531                matrix=(double*)xmalloc(M*N*sizeof(double));
     532
     533                /*Read matrix on node 0, then broadcast: */
     534                if(my_rank==0){ 
     535                        if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
     536                }
     537               
     538                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     539        }
     540
     541        /*Now cast to integer: */
     542        if(M*N){
     543                integer_matrix=(int*)xmalloc(M*N*sizeof(int));
     544                for (i=0;i<M;i++){
     545                        for (j=0;j<N;j++){
     546                                integer_matrix[i*N+j]=(int)matrix[i*N+j];
     547                        }
     548                }
     549        }
     550        else{
     551                integer_matrix=NULL;
     552        }
     553        /*Free ressources:*/
     554        xfree((void**)&matrix);
     555
     556        /*Assign output pointers: */
     557        *pmatrix=integer_matrix;
     558        if (pM)*pM=M;
     559        if (pN)*pN=N;
     560
     561}
     562/*}}}*/
     563/*FUNCTION IoModel::FetchData(double**  pdoublematrix,int* pM,int* pN,int data_enum){{{1*/
     564void  IoModel::FetchData(double** pmatrix,int* pM,int* pN,int data_enum){
     565
     566        extern int my_rank;
     567        extern int num_procs;
     568
     569        /*output: */
     570        int M,N;
     571        double* matrix=NULL;
     572        int code=0;
     573        int vector_type=0;
     574       
     575        /*Set file pointer to beginning of the data: */
     576        fid=this->SetFilePointerToData(&code,&vector_type,data_enum);
     577        if((code!=5) && (code!=6) && (code!=7))_error_("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum));
     578       
     579        /*Now fetch: */
     580
     581        /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
     582        /*numberofelements: */
     583        if(my_rank==0){ 
     584                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
     585        }
     586        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     587
     588        if(my_rank==0){ 
     589                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
     590        }
     591        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     592
     593        /*Now allocate matrix: */
     594        if(M*N){
     595                matrix=(double*)xmalloc(M*N*sizeof(double));
     596
     597                /*Read matrix on node 0, then broadcast: */
     598                if(my_rank==0){ 
     599                        if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
     600                }
     601                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     602        }
     603
     604        /*Assign output pointers: */
     605        *pmatrix=matrix;
     606        if (pM)*pM=M;
     607        if (pN)*pN=N;
     608}
     609/*}}}*/
     610/*FUNCTION IoModel::FetchData(char***   pstrings,int* pnumstrings,int data_enum){{{1*/
     611void  IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){
     612
     613        extern int my_rank;
     614        extern int num_procs;
     615       
     616        int i;
     617
     618        /*output: */
     619        int   numstrings=0;
     620        char** strings=NULL;
     621       
     622        /*intermediary: */
     623        char* string=NULL;
     624        int   string_size;
     625        int   code;
     626       
     627        /*Set file pointer to beginning of the data: */
     628        fid=this->SetFilePointerToData(&code,NULL,data_enum);
     629       
     630        if(code!=9)_error_("expecting a string array for enum %s",EnumToStringx(data_enum));
     631       
     632        /*We have to read a bunch of strings from disk. First read the number of strings, and allocate: */
     633        if(my_rank==0){ 
     634                if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_(" could not read length of string array");
     635        }
     636        MPI_Bcast(&numstrings,1,MPI_INT,0,MPI_COMM_WORLD);
     637
     638        /*Now allocate string array: */
     639        if(numstrings){
     640                strings=(char**)xmalloc(numstrings*sizeof(char*));
     641                for(i=0;i<numstrings;i++)strings[i]=NULL;
     642
     643                /*Go through strings, and read: */
     644                for(i=0;i<numstrings;i++){
    777645                       
    778                         /*Is this the record sought for? : */
    779                         if (data_enum==record_enum){
    780                                 /*Ok, we have found the correct string. Pass the record length, and read data type code: */
    781                                 fseek(fid,sizeof(int),SEEK_CUR);
    782                                 fread(&record_code,sizeof(int),1,fid);
    783 
    784                                 /*if record_code points to a vector, get its type (nodal or elementary): */
    785                                 if(5<=record_code && record_code<=7)fread(&vector_type,sizeof(int),1,fid);
    786                                 found=1;
    787                                 break;
     646                        if(my_rank==0){ 
     647                                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_(" could not read length of string ");
     648                        }
     649                        MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     650                        if(string_size){
     651                                string=(char*)xmalloc((string_size+1)*sizeof(char));
     652                                string[string_size]='\0';
     653
     654                                /*Read string on node 0, then broadcast: */
     655                                if(my_rank==0){ 
     656                                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
     657                                }
     658                                MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
    788659                        }
    789660                        else{
    790                                 /*This is not the correct string, read the record length, and use it to skip this record: */
    791                                 fread(&record_length,sizeof(int),1,fid);
    792                                 /*skip: */
    793                                 fseek(fid,record_length,SEEK_CUR);
    794                         }
    795                 }
    796         }
    797         MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD);
    798         if(!found)_error_("%s %s ","could not find data with name",EnumToStringx(data_enum));
    799 
    800         /*Broadcast code and vector type: */
    801         MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);
    802         MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
    803         if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
    804 
    805         /*Assign output pointers:*/
    806         *pcode=record_code;
    807         if(pvector_type)*pvector_type=vector_type;
    808 
    809         return fid;
    810 }
    811 /*}}}*/
    812 /*FUNCTION IoModel::FetchDataToInput(Elements* elements,IoModel* iomodel,int vector_enum,int default_vector_enum,double default_value{{{1*/
     661                                string=(char*)xmalloc(sizeof(char));
     662                                string[0]='\0';
     663                        }
     664
     665                        strings[i]=string;
     666                }
     667        }
     668
     669        /*Assign output pointers: */
     670        *pstrings=strings;
     671        *pnumstrings=numstrings;
     672}
     673/*}}}*/
     674/*FUNCTION IoModel::FetchData(double*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{1*/
     675void  IoModel::FetchData(double*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){
     676
     677        int i;
     678
     679        extern int my_rank;
     680        extern int num_procs;
     681
     682        /*output: */
     683        double** matrices=NULL;
     684        int*     mdims=NULL;
     685        int*     ndims=NULL;
     686        int      numrecords=0;
     687
     688        /*intermediary: */
     689        int     M, N;
     690        double *matrix = NULL;
     691        int     code;
     692       
     693        /*Set file pointer to beginning of the data: */
     694        fid=this->SetFilePointerToData(&code,NULL,data_enum);
     695        if(code!=8)_error_("expecting a double mat array for enum %s",EnumToStringx(data_enum));
     696       
     697        /*Now fetch: */
     698        if(my_rank==0){ 
     699                if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
     700        }
     701        MPI_Bcast(&numrecords,1,MPI_INT,0,MPI_COMM_WORLD);
     702
     703        if(numrecords){
     704
     705                /*Allocate matrices :*/
     706                matrices=(double**)xmalloc(numrecords*sizeof(double*));
     707                mdims=(int*)xmalloc(numrecords*sizeof(int));
     708                ndims=(int*)xmalloc(numrecords*sizeof(int));
     709
     710                for(i=0;i<numrecords;i++){
     711                        matrices[i]=NULL;
     712                        mdims[i]=0;
     713                        ndims[i]=0;
     714                }
     715
     716                /*Loop through records and fetch matrix: */
     717                for(i=0;i<numrecords;i++){
     718
     719                        if(my_rank==0){ 
     720                                if(fread(&M,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of rows in ",i,"th matrix of matrix array");
     721                        }
     722                        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     723
     724                        if(my_rank==0){ 
     725                                if(fread(&N,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of columns in ",i,"th matrix of matrix array");
     726                        }
     727                        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     728
     729                        /*Now allocate matrix: */
     730                        if(M*N){
     731                                matrix=(double*)xmalloc(M*N*sizeof(double));
     732
     733                                /*Read matrix on node 0, then broadcast: */
     734                                if(my_rank==0){ 
     735                                        if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
     736                                }
     737
     738                                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     739                        }
     740
     741                        /*Assign: */
     742                        matrices[i]=matrix;
     743                        mdims[i]=M;
     744                        ndims[i]=N;
     745                }
     746        }
     747
     748        /*Assign output pointers: */
     749        *pmatrices=matrices;
     750        *pmdims=mdims;
     751        *pndims=ndims;
     752        *pnumrecords=numrecords;
     753}
     754/*}}}*/
     755/*FUNCTION IoModel::FetchData(int num,...){{{1*/
     756void  IoModel::FetchData(int num,...){
     757
     758        va_list ap;
     759        int     dataenum;
     760        double* matrix=NULL;
     761        int     M,N;
     762        int     i;
     763
     764        /*Go through the entire list of enums and fetch the corresponding data. Add it to the iomodel->data dataset. Everything
     765         *we fetch is a double* : */
     766       
     767        va_start(ap,num);
     768        for(i=0; i<num; i++){
     769               
     770                dataenum=va_arg(ap, int);
     771
     772                /*Some checks in debugging mode*/
     773                /*{{{*/
     774                #ifdef _ISSM_DEBUG_
     775                _assert_(dataenum<MaximumNumberOfEnums);
     776                if(this->data[dataenum]){
     777                        _error_("Info: trying to fetch %s but previous pointer has not been freed (DeleteData has not been called)",EnumToStringx(dataenum));
     778                }
     779                #endif
     780                /*}}}*/
     781
     782                /*Add to this->data: */
     783                this->FetchData(&matrix,&M,&N,dataenum);
     784                this->data[dataenum]=matrix;
     785        }
     786        va_end(ap);
     787
     788}
     789/*}}}*/
     790/*FUNCTION IoModel::FetchDataToInput{{{1*/
    813791void IoModel::FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum,double default_value){
    814792
     
    1005983        xfree((void**)&string);
    1006984}
     985/*FUNCTION IoModel::SetFilePointerToData{{{1*/
     986FILE* IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){
     987
     988        extern int my_rank;
     989        extern int num_procs;
     990       
     991        int found=0;
     992        int record_enum;
     993        int record_length;
     994        int record_code; //1 to 7 number
     995        int vector_type; //nodal or elementary
     996 
     997        /*Go find in the binary file, the position of the data we want to fetch: */
     998        if(my_rank==0){
     999       
     1000                /*First set FILE* position to the beginning of the file: */
     1001                fseek(fid,0,SEEK_SET);
     1002
     1003                /*Now march through file looking for the correct data identifier: */
     1004                for(;;){
     1005                        /*Read enum for this size of first string name: */
     1006                        if(fread(&record_enum,sizeof(int),1,fid)==0){
     1007                                /*Ok, we have reached the end of the file. break: */
     1008                                found=0;
     1009                                break;
     1010                        }
     1011                       
     1012                        /*Is this the record sought for? : */
     1013                        if (data_enum==record_enum){
     1014                                /*Ok, we have found the correct string. Pass the record length, and read data type code: */
     1015                                fseek(fid,sizeof(int),SEEK_CUR);
     1016                                fread(&record_code,sizeof(int),1,fid);
     1017
     1018                                /*if record_code points to a vector, get its type (nodal or elementary): */
     1019                                if(5<=record_code && record_code<=7)fread(&vector_type,sizeof(int),1,fid);
     1020                                found=1;
     1021                                break;
     1022                        }
     1023                        else{
     1024                                /*This is not the correct string, read the record length, and use it to skip this record: */
     1025                                fread(&record_length,sizeof(int),1,fid);
     1026                                /*skip: */
     1027                                fseek(fid,record_length,SEEK_CUR);
     1028                        }
     1029                }
     1030        }
     1031        MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD);
     1032        if(!found)_error_("%s %s ","could not find data with name",EnumToStringx(data_enum));
     1033
     1034        /*Broadcast code and vector type: */
     1035        MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);
     1036        MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
     1037        if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
     1038
     1039        /*Assign output pointers:*/
     1040        *pcode=record_code;
     1041        if(pvector_type)*pvector_type=vector_type;
     1042
     1043        return fid;
     1044}
     1045/*}}}*/
  • issm/trunk/src/c/objects/IoModel.h

    r9380 r9405  
    1717
    1818        private:
    19                 FILE    *fid; //pointer to input file
    20                 double **data;//this dataset holds temporary data, memory intensive.
     19                FILE        *fid;         //pointer to input file
     20                double     **data;        //this dataset holds temporary data, memory intensive.
     21                Parameters  *constants;   //this dataset holds all double, int, bool and char *parameters read in from the input file.*
    2122
    2223        public:
    23                 Parameters *constants;   //this dataset holds all double, int, bool and char*parameters read in from the input file.*
    24 
    2524                /*This data needs to stay memory resident at all time, even if it's memory intensive: */
    2625                bool *my_elements;
     
    3534                int constraintcounter;   //keep track of how many constraints are being created in each analysis type
    3635
    37                 /*Methods: {{{1*/
     36                /*Methods*/
    3837                ~IoModel();
    3938                IoModel();
    4039                IoModel(FILE* iomodel_handle);
    41                 /*}}}*/
    42                 /*Input/Output:{{{1*/
    43                 void  FetchData(bool*     pboolean,int data_enum);
    44                 void  FetchData(int*      pinteger,int data_enum);
    45                 void  FetchData(double*   pscalar,int data_enum);
    46                 void  FetchData(char**    pstring,int data_enum);
    47                 void  FetchData(int** pmatrix,int* pM,int* pN,int data_enum);
    48                 void  FetchData(double**  pscalarmatrix,int* pM,int* pN,int data_enum);
    49                 void  FetchData(char***   pstringarray,int* pnumstrings,int data_enum);
    50                 void  FetchData(double*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
    51                 void  FetchParameters(Parameters* parameters);
    52                 FILE* SetFilePointerToData(int* pcode,int* pvector_type, int data_enum);
    53                 void  FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,double default_value=0);
    54                 void  FetchData(int num,...);
    55                 double* f(int dataenum);
    56                 void  DeleteData(int num,...);
    57                 /*}}}*/
    5840
     41                /*Input/Output*/
     42                void        Constant(bool   *poutput,int constant_enum);
     43                void        Constant(int    *poutput,int constant_enum);
     44                void        Constant(double *poutput,int constant_enum);
     45                Parameters *CopyConstants(void);
     46                double     *Data(int dataenum);
     47                void        DeleteData(int num,...);
     48                void        FetchConstants(void);
     49                void        FetchData(bool*     pboolean,int data_enum);
     50                void        FetchData(int*      pinteger,int data_enum);
     51                void        FetchData(double*   pscalar,int data_enum);
     52                void        FetchData(char**    pstring,int data_enum);
     53                void        FetchData(int** pmatrix,int* pM,int* pN,int data_enum);
     54                void        FetchData(double**  pscalarmatrix,int* pM,int* pN,int data_enum);
     55                void        FetchData(char***   pstringarray,int* pnumstrings,int data_enum);
     56                void        FetchData(double*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
     57                void        FetchData(int num,...);
     58                void        FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,double default_value=0);
     59                FILE*       SetFilePointerToData(int* pcode,int* pvector_type, int data_enum);
    5960};
    6061
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r9386 r9405  
    5454       
    5555        /*find parameters: */
    56         iomodel->constants->FindParam(&dim,DimEnum);
    57         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     56        iomodel->Constant(&dim,DimEnum);
     57        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    5858
    5959        /*First, retrieve element index and element type: */
     
    6464                segment_width=6;
    6565        }
    66         _assert_(iomodel->f(PressureloadEnum));
    67         element=(int)(*(iomodel->f(PressureloadEnum)+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill)
     66        _assert_(iomodel->Data(PressureloadEnum));
     67        element=(int)(*(iomodel->Data(PressureloadEnum)+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill)
    6868
    6969        /*Build ids for hook constructors: */
    70         icefront_eid=(int) *(iomodel->f(PressureloadEnum)+segment_width*i+segment_width-2); //matlab indexing
     70        icefront_eid=(int) *(iomodel->Data(PressureloadEnum)+segment_width*i+segment_width-2); //matlab indexing
    7171        icefront_mparid=numberofelements+1; //matlab indexing
    7272
    7373        if (in_icefront_type==MacAyeal2dIceFrontEnum || in_icefront_type==MacAyeal3dIceFrontEnum){
    74                 icefront_node_ids[0]=iomodel->nodecounter+(int)*(iomodel->f(PressureloadEnum)+segment_width*i+0);
    75                 icefront_node_ids[1]=iomodel->nodecounter+(int)*(iomodel->f(PressureloadEnum)+segment_width*i+1);
     74                icefront_node_ids[0]=iomodel->nodecounter+(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+0);
     75                icefront_node_ids[1]=iomodel->nodecounter+(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+1);
    7676        }
    7777        else if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum){
    78                 icefront_node_ids[0]=iomodel->nodecounter+(int)*(iomodel->f(PressureloadEnum)+segment_width*i+0);
    79                 icefront_node_ids[1]=iomodel->nodecounter+(int)*(iomodel->f(PressureloadEnum)+segment_width*i+1);
    80                 icefront_node_ids[2]=iomodel->nodecounter+(int)*(iomodel->f(PressureloadEnum)+segment_width*i+2);
    81                 icefront_node_ids[3]=iomodel->nodecounter+(int)*(iomodel->f(PressureloadEnum)+segment_width*i+3);
     78                icefront_node_ids[0]=iomodel->nodecounter+(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+0);
     79                icefront_node_ids[1]=iomodel->nodecounter+(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+1);
     80                icefront_node_ids[2]=iomodel->nodecounter+(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+2);
     81                icefront_node_ids[3]=iomodel->nodecounter+(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+3);
    8282        }
    8383        else _error_("in_icefront_type %s not supported yet!",EnumToStringx(in_icefront_type));
     
    8585        if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum) num_nodes=4;
    8686        else num_nodes=2;
    87         icefront_fill=(int)*(iomodel->f(PressureloadEnum)+segment_width*i+segment_width-1);
     87        icefront_fill=(int)*(iomodel->Data(PressureloadEnum)+segment_width*i+segment_width-1);
    8888       
    8989        /*Ok, we have everything to build the object: */
  • issm/trunk/src/c/objects/Loads/Numericalflux.cpp

    r9362 r9405  
    5454
    5555        /*Fetch parameters: */
    56         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     56        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    5757
    5858        /* Get MatPar id */
     
    6060
    6161        /*First, see wether this is an internal or boundary edge (if e2=NaN)*/
    62         if (isnan((double)iomodel->f(EdgesEnum)[4*i+3])){ //edges are [node1 node2 elem1 elem2]
     62        if (isnan((double)iomodel->Data(EdgesEnum)[4*i+3])){ //edges are [node1 node2 elem1 elem2]
    6363                /* Boundary edge, only one element */
    64                 e1=(int)iomodel->f(EdgesEnum)[4*i+2];
     64                e1=(int)iomodel->Data(EdgesEnum)[4*i+2];
    6565                e2=(int)UNDEF;
    6666                num_elems=1;
     
    7171        else{
    7272                /* internal edge: connected to 2 elements */
    73                 e1=(int)iomodel->f(EdgesEnum)[4*i+2];
    74                 e2=(int)iomodel->f(EdgesEnum)[4*i+3];
     73                e1=(int)iomodel->Data(EdgesEnum)[4*i+2];
     74                e2=(int)iomodel->Data(EdgesEnum)[4*i+3];
    7575                num_elems=2;
    7676                num_nodes=4;
     
    8181
    8282        /*1: Get vertices ids*/
    83         i1=(int)iomodel->f(EdgesEnum)[4*i+0];
    84         i2=(int)iomodel->f(EdgesEnum)[4*i+1];
     83        i1=(int)iomodel->Data(EdgesEnum)[4*i+0];
     84        i2=(int)iomodel->Data(EdgesEnum)[4*i+1];
    8585
    8686        if (numericalflux_type==InternalEnum){
     
    9191                pos1=pos2=pos3=pos4=UNDEF;
    9292                for(j=0;j<3;j++){
    93                         if (iomodel->f(ElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
    94                         if (iomodel->f(ElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
    95                         if (iomodel->f(ElementsEnum)[3*(e2-1)+j]==i1) pos3=j+1;
    96                         if (iomodel->f(ElementsEnum)[3*(e2-1)+j]==i2) pos4=j+1;
     93                        if (iomodel->Data(ElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
     94                        if (iomodel->Data(ElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
     95                        if (iomodel->Data(ElementsEnum)[3*(e2-1)+j]==i1) pos3=j+1;
     96                        if (iomodel->Data(ElementsEnum)[3*(e2-1)+j]==i2) pos4=j+1;
    9797                }
    9898                _assert_(pos1!=UNDEF && pos2!=UNDEF && pos3!=UNDEF && pos4!=UNDEF);
     
    110110                pos1=pos2=UNDEF;
    111111                for(j=0;j<3;j++){
    112                         if (iomodel->f(ElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
    113                         if (iomodel->f(ElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
     112                        if (iomodel->Data(ElementsEnum)[3*(e1-1)+j]==i1) pos1=j+1;
     113                        if (iomodel->Data(ElementsEnum)[3*(e1-1)+j]==i2) pos2=j+1;
    114114                }
    115115                _assert_(pos1!=UNDEF && pos2!=UNDEF);
  • issm/trunk/src/c/objects/Loads/Pengrid.cpp

    r9362 r9405  
    5353
    5454        /*Fetch parameters: */
    55         iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum);
    56         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
     55        iomodel->Constant(&numberofvertices,NumberOfVerticesEnum);
     56        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
    5757
    5858        /*Some checks if debugging activated*/
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r9362 r9405  
    5656
    5757        /*Fetch parameters: */
    58         iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum);
    59         iomodel->constants->FindParam(&penalty_lock,PenaltyLockEnum);
     58        iomodel->Constant(&numberofelements,NumberOfElementsEnum);
     59        iomodel->Constant(&penalty_lock,PenaltyLockEnum);
    6060
    6161        /*Ok, retrieve all the data needed to add a penalty between the two nodes: */
    62         el1=(int)*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+2);
    63         el2=(int)*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+3);
    64 
    65         node1=(int)*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+0);
    66         node2=(int)*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+1);
     62        el1=(int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+2);
     63        el2=(int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+3);
     64
     65        node1=(int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+0);
     66        node2=(int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+1);
    6767
    6868        /*id: */
     
    8989        this->penalty_lock=penalty_lock;
    9090        this->material_converged=0;
    91         this->normal[0]=*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+4);
    92         this->normal[1]=*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+5);
    93         this->length=*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+6);
    94         this->fraction=*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+9);
    95         this->state=(int)*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+11);
     91        this->normal[0]=*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+4);
     92        this->normal[1]=*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+5);
     93        this->length=*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+6);
     94        this->fraction=*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+9);
     95        this->state=(int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+11);
    9696
    9797        //intialize inputs, and add as many inputs per element as requested:
     
    9999               
    100100        riftfront_type=SegmentRiftfrontEnum;
    101         riftfront_fill = (int)*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+7);
    102         riftfront_friction=*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+8);
    103         riftfront_fractionincrement=*(iomodel->f(RiftinfoEnum)+RIFTINFOSIZE*i+10);
    104         riftfront_shelf=(bool)iomodel->f(NodeOnIceShelfEnum)[node1-1];
     101        riftfront_fill = (int)*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+7);
     102        riftfront_friction=*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+8);
     103        riftfront_fractionincrement=*(iomodel->Data(RiftinfoEnum)+RIFTINFOSIZE*i+10);
     104        riftfront_shelf=(bool)iomodel->Data(NodeOnIceShelfEnum)[node1-1];
    105105
    106106        this->inputs->AddInput(new IntInput(TypeEnum,riftfront_type));
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r9380 r9405  
    660660
    661661        /*Fetch parameters: */
    662         iomodel->constants->FindParam(&dim,DimEnum);
    663         iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum);
    664         iomodel->constants->FindParam(&num_control_type,NumControlTypeEnum);
     662        iomodel->Constant(&dim,DimEnum);
     663        iomodel->Constant(&control_analysis,ControlAnalysisEnum);
     664        iomodel->Constant(&num_control_type,NumControlTypeEnum);
    665665
    666666        /*if 2d*/
     
    674674
    675675                /*Get B*/
    676                 if (iomodel->f(RheologyBEnum)) {
    677                         for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->f(RheologyBEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+i]-1)];
     676                if (iomodel->Data(RheologyBEnum)) {
     677                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(RheologyBEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+i]-1)];
    678678                        this->inputs->AddInput(new TriaVertexInput(RheologyBbarEnum,nodeinputs));
    679679                }
    680680
    681681                /*Get n*/
    682                 if (iomodel->f(RheologyNEnum)) {
    683                         for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->f(RheologyNEnum)[index];
     682                if (iomodel->Data(RheologyNEnum)) {
     683                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(RheologyNEnum)[index];
    684684                        this->inputs->AddInput(new TriaVertexInput(RheologyNEnum,nodeinputs));
    685685                }
    686686
    687687                /*Control Inputs*/
    688                 if (control_analysis && iomodel->f(ControlTypeEnum)){
     688                if (control_analysis && iomodel->Data(ControlTypeEnum)){
    689689                        for(i=0;i<num_control_type;i++){
    690                                 switch((int)iomodel->f(ControlTypeEnum)[i]){
     690                                switch((int)iomodel->Data(ControlTypeEnum)[i]){
    691691                                        case RheologyBbarEnum:
    692                                                 if (iomodel->f(RheologyBEnum)){
    693                                                         _assert_(iomodel->f(RheologyBEnum));_assert_(iomodel->f(CmMinEnum)); _assert_(iomodel->f(CmMaxEnum));
    694                                                         for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->f(RheologyBEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+j]-1)];
    695                                                         for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
    696                                                         for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     692                                                if (iomodel->Data(RheologyBEnum)){
     693                                                        _assert_(iomodel->Data(RheologyBEnum));_assert_(iomodel->Data(CmMinEnum)); _assert_(iomodel->Data(CmMaxEnum));
     694                                                        for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(RheologyBEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+j]-1)];
     695                                                        for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     696                                                        for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
    697697                                                        this->inputs->AddInput(new ControlInput(RheologyBbarEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    698698                                                }
     
    713713
    714714                /*Get B*/
    715                 if (iomodel->f(RheologyBEnum)) {
    716                         for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->f(RheologyBEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+i]-1)];
     715                if (iomodel->Data(RheologyBEnum)) {
     716                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(RheologyBEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+i]-1)];
    717717                        this->inputs->AddInput(new PentaVertexInput(RheologyBEnum,nodeinputs));
    718718                }
    719719
    720720                /*Get n*/
    721                 if (iomodel->f(RheologyNEnum)) {
    722                         for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->f(RheologyNEnum)[index];
     721                if (iomodel->Data(RheologyNEnum)) {
     722                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(RheologyNEnum)[index];
    723723                        this->inputs->AddInput(new PentaVertexInput(RheologyNEnum,nodeinputs));
    724724                }
    725725
    726726                /*Control Inputs*/
    727                 if (control_analysis && iomodel->f(ControlTypeEnum)){
     727                if (control_analysis && iomodel->Data(ControlTypeEnum)){
    728728                        for(i=0;i<num_control_type;i++){
    729                                 switch((int)iomodel->f(ControlTypeEnum)[i]){
     729                                switch((int)iomodel->Data(ControlTypeEnum)[i]){
    730730                                        case RheologyBbarEnum:
    731                                                 if (iomodel->f(RheologyBEnum)){
    732                                                         _assert_(iomodel->f(RheologyBEnum));_assert_(iomodel->f(CmMinEnum)); _assert_(iomodel->f(CmMaxEnum));
    733                                                         for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->f(RheologyBEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+j]-1)];
    734                                                         for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->f(CmMinEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
    735                                                         for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->f(CmMaxEnum)[int(iomodel->f(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     731                                                if (iomodel->Data(RheologyBEnum)){
     732                                                        _assert_(iomodel->Data(RheologyBEnum));_assert_(iomodel->Data(CmMinEnum)); _assert_(iomodel->Data(CmMaxEnum));
     733                                                        for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(RheologyBEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+j]-1)];
     734                                                        for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(CmMinEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     735                                                        for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(CmMaxEnum)[int(iomodel->Data(ElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
    736736                                                        this->inputs->AddInput(new ControlInput(RheologyBEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
    737737                                                }
  • issm/trunk/src/c/objects/Materials/Matpar.cpp

    r9362 r9405  
    2626
    2727        this->mid                       = matpar_mid;
    28         iomodel->constants->FindParam(&this->rho_ice,RhoIceEnum);
    29         iomodel->constants->FindParam(&this->rho_water,RhoWaterEnum);
    30         iomodel->constants->FindParam(&this->heatcapacity,HeatcapacityEnum);
    31         iomodel->constants->FindParam(&this->thermalconductivity,ThermalconductivityEnum);
    32         iomodel->constants->FindParam(&this->latentheat,LatentheatEnum);
    33         iomodel->constants->FindParam(&this->beta,BetaEnum);
    34         iomodel->constants->FindParam(&this->meltingpoint,MeltingpointEnum);
    35         iomodel->constants->FindParam(&this->referencetemperature,ReferencetemperatureEnum);
    36         iomodel->constants->FindParam(&this->mixed_layer_capacity,MixedLayerCapacityEnum);
    37         iomodel->constants->FindParam(&this->thermal_exchange_velocity,ThermalExchangeVelocityEnum);
    38         iomodel->constants->FindParam(&this->g,GEnum);
    39        
    40         iomodel->constants->FindParam(&this->kn,HydroKnEnum);
    41         iomodel->constants->FindParam(&this->hydro_p,HydroPEnum);
    42         iomodel->constants->FindParam(&this->hydro_q,HydroQEnum);
    43         iomodel->constants->FindParam(&this->hydro_CR,HydroCREnum);
    44         iomodel->constants->FindParam(&this->hydro_n,HydroNEnum);
     28        iomodel->Constant(&this->rho_ice,RhoIceEnum);
     29        iomodel->Constant(&this->rho_water,RhoWaterEnum);
     30        iomodel->Constant(&this->heatcapacity,HeatcapacityEnum);
     31        iomodel->Constant(&this->thermalconductivity,ThermalconductivityEnum);
     32        iomodel->Constant(&this->latentheat,LatentheatEnum);
     33        iomodel->Constant(&this->beta,BetaEnum);
     34        iomodel->Constant(&this->meltingpoint,MeltingpointEnum);
     35        iomodel->Constant(&this->referencetemperature,ReferencetemperatureEnum);
     36        iomodel->Constant(&this->mixed_layer_capacity,MixedLayerCapacityEnum);
     37        iomodel->Constant(&this->thermal_exchange_velocity,ThermalExchangeVelocityEnum);
     38        iomodel->Constant(&this->g,GEnum);
     39       
     40        iomodel->Constant(&this->kn,HydroKnEnum);
     41        iomodel->Constant(&this->hydro_p,HydroPEnum);
     42        iomodel->Constant(&this->hydro_q,HydroQEnum);
     43        iomodel->Constant(&this->hydro_CR,HydroCREnum);
     44        iomodel->Constant(&this->hydro_n,HydroNEnum);
    4545}
    4646/*}}}1*/
  • issm/trunk/src/c/objects/Node.cpp

    r9380 r9405  
    3737
    3838        /*Fetch parameters: */
    39         iomodel->constants->FindParam(&dim,DimEnum);
     39        iomodel->Constant(&dim,DimEnum);
    4040
    4141        /*id: */
     
    4646
    4747        /*indexing:*/
    48         DistributeNumDofs(&this->indexing,analysis_type,iomodel->f(VerticesTypeEnum)+io_index); //number of dofs per node
     48        DistributeNumDofs(&this->indexing,analysis_type,iomodel->Data(VerticesTypeEnum)+io_index); //number of dofs per node
    4949        gsize=this->indexing.gsize;
    5050
     
    5454        //intialize inputs, and add as many inputs per element as requested:
    5555        this->inputs=new Inputs();
    56         if (iomodel->f(NodeOnBedEnum))      this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->f(NodeOnBedEnum)[io_index]));
    57         if (iomodel->f(NodeOnSurfaceEnum))  this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->f(NodeOnSurfaceEnum)[io_index]));
    58         if (iomodel->f(NodeOnIceShelfEnum)) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->f(NodeOnIceShelfEnum)[io_index]));
    59         if (iomodel->f(NodeOnIceSheetEnum)) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->f(NodeOnIceSheetEnum)[io_index]));
     56        if (iomodel->Data(NodeOnBedEnum))      this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->Data(NodeOnBedEnum)[io_index]));
     57        if (iomodel->Data(NodeOnSurfaceEnum))  this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->Data(NodeOnSurfaceEnum)[io_index]));
     58        if (iomodel->Data(NodeOnIceShelfEnum)) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->Data(NodeOnIceShelfEnum)[io_index]));
     59        if (iomodel->Data(NodeOnIceSheetEnum)) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->Data(NodeOnIceSheetEnum)[io_index]));
    6060        if (iomodel->numbernodetoelementconnectivity) this->inputs->AddInput(new IntInput(NumberNodeToElementConnectivityEnum,(IssmInt)iomodel->numbernodetoelementconnectivity[io_index]));
    61         if (analysis_type==DiagnosticHorizAnalysisEnum) this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->f(VerticesTypeEnum)[io_index]));
     61        if (analysis_type==DiagnosticHorizAnalysisEnum) this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->Data(VerticesTypeEnum)[io_index]));
    6262       
    6363        /*set single point constraints: */
    6464
    6565        /*spc all nodes on water*/
    66         if (!iomodel->f(NodeOnWaterEnum)) _error_("iomodel->nodeonwater is NULL");
    67         if (iomodel->f(NodeOnWaterEnum)[io_index]){
     66        if (!iomodel->Data(NodeOnWaterEnum)) _error_("iomodel->nodeonwater is NULL");
     67        if (iomodel->Data(NodeOnWaterEnum)[io_index]){
    6868                for(k=1;k<=gsize;k++){
    6969                        this->FreezeDof(k);
     
    7575                if (dim==3){
    7676                        /*We have a  3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
    77                         if (!iomodel->f(NodeOnBedEnum)) _error_("iomodel->nodeonbed is NULL");
    78                         if (!iomodel->f(VerticesTypeEnum)) _error_("iomodel->vertices_type is NULL");
    79                         if (iomodel->f(VerticesTypeEnum)[io_index]==MacAyealApproximationEnum && !iomodel->f(NodeOnBedEnum)[io_index]){
     77                        if (!iomodel->Data(NodeOnBedEnum)) _error_("iomodel->nodeonbed is NULL");
     78                        if (!iomodel->Data(VerticesTypeEnum)) _error_("iomodel->vertices_type is NULL");
     79                        if (iomodel->Data(VerticesTypeEnum)[io_index]==MacAyealApproximationEnum && !iomodel->Data(NodeOnBedEnum)[io_index]){
    8080                                for(k=1;k<=gsize;k++) this->FreezeDof(k);
    8181                        }
    82                         if (iomodel->f(VerticesTypeEnum)[io_index]==MacAyealPattynApproximationEnum && iomodel->f(NodeOnMacayealEnum)[io_index]){
    83                                 if(!iomodel->f(NodeOnBedEnum)[io_index]){
     82                        if (iomodel->Data(VerticesTypeEnum)[io_index]==MacAyealPattynApproximationEnum && iomodel->Data(NodeOnMacayealEnum)[io_index]){
     83                                if(!iomodel->Data(NodeOnBedEnum)[io_index]){
    8484                                        for(k=1;k<=gsize;k++) this->FreezeDof(k);
    8585                                }
    8686                        }
    87                         if (iomodel->f(VerticesTypeEnum)[io_index]==MacAyealStokesApproximationEnum && iomodel->f(NodeOnMacayealEnum)[io_index]){
    88                                 if(!iomodel->f(NodeOnBedEnum)[io_index]){
     87                        if (iomodel->Data(VerticesTypeEnum)[io_index]==MacAyealStokesApproximationEnum && iomodel->Data(NodeOnMacayealEnum)[io_index]){
     88                                if(!iomodel->Data(NodeOnBedEnum)[io_index]){
    8989                                        for(k=1;k<=2;k++) this->FreezeDof(k);
    9090                                }
     
    9292                }
    9393                /*spc all nodes on hutter*/
    94                 if (!iomodel->f(NodeOnHutterEnum)) _error_("iomodel->nodeonhutter is NULL");
    95                 if (iomodel->f(NodeOnHutterEnum)[io_index]){
     94                if (!iomodel->Data(NodeOnHutterEnum)) _error_("iomodel->nodeonhutter is NULL");
     95                if (iomodel->Data(NodeOnHutterEnum)[io_index]){
    9696                        for(k=1;k<=gsize;k++){
    9797                                this->FreezeDof(k);
     
    104104        if (analysis_type==DiagnosticHutterAnalysisEnum){
    105105                /*Constrain all nodes that are not Hutter*/
    106                 if (!iomodel->f(NodeOnHutterEnum)) _error_("iomodel->nodeonhutter is NULL");
    107                 if (!iomodel->f(NodeOnHutterEnum)[io_index]){
     106                if (!iomodel->Data(NodeOnHutterEnum)) _error_("iomodel->nodeonhutter is NULL");
     107                if (!iomodel->Data(NodeOnHutterEnum)[io_index]){
    108108                        for(k=1;k<=gsize;k++){
    109109                                this->FreezeDof(k);
     
    122122                if (dim==3){
    123123                        /*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
    124                         _assert_(iomodel->f(NodeOnBedEnum));
    125                         if (!iomodel->f(NodeOnBedEnum)[io_index]){
     124                        _assert_(iomodel->Data(NodeOnBedEnum));
     125                        if (!iomodel->Data(NodeOnBedEnum)[io_index]){
    126126                                for(k=1;k<=gsize;k++){
    127127                                        this->FreezeDof(k);
  • issm/trunk/src/c/objects/Vertex.cpp

    r9362 r9405  
    3131Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel){
    3232
    33         this->Init(vertex_id, vertex_sid, iomodel->f(XEnum)[i],iomodel->f(YEnum)[i],iomodel->f(ZEnum)[i],(iomodel->f(ZEnum)[i]-iomodel->f(BedEnum)[i])/(iomodel->f(ThicknessEnum)[i]));
     33        this->Init(vertex_id, vertex_sid, iomodel->Data(XEnum)[i],iomodel->Data(YEnum)[i],iomodel->Data(ZEnum)[i],(iomodel->Data(ZEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]));
    3434
    3535}
  • issm/trunk/src/m/classes/model.m

    r9401 r9405  
    253253                 %Results fields
    254254                 output_frequency                    = {0,true,'Integer'};
     255                 results_on_vertices                 = {0,true,'Boolean'};
    255256                 inputfilename                       = {'',true,'String'};
    256257                 outputfilename                      = {'',true,'String'};
Note: See TracChangeset for help on using the changeset viewer.