Changeset 9405
- Timestamp:
- 08/24/11 12:10:50 (14 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 1 added
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r9401 r9405 553 553 SpcDynamicEnum, 554 554 NumberOfEdgesEnum, 555 ResultsOnVerticesEnum, 555 556 MaximumNumberOfEnums 556 557 }; -
issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
r9401 r9405 495 495 case SpcDynamicEnum : return "SpcDynamic"; 496 496 case NumberOfEdgesEnum : return "NumberOfEdges"; 497 case ResultsOnVerticesEnum : return "ResultsOnVertices"; 497 498 default : return "unknown"; 498 499 -
issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
r9362 r9405 33 33 34 34 /*Fetch parameters: */ 35 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);35 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 36 36 37 37 /*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 13 13 14 14 /*Fetch parameters: */ 15 iomodel-> constants->FindParam(&prognostic_DG,PrognosticDGEnum);15 iomodel->Constant(&prognostic_DG,PrognosticDGEnum); 16 16 17 17 /*Output*/ -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp
r9391 r9405 20 20 21 21 /*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); 24 24 25 25 /*Output*/ … … 42 42 43 43 /*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] 45 45 46 46 /*Now, if this element is not in the partition, pass: */ -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp
r9372 r9405 30 30 31 31 /*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); 36 36 37 37 /*Recover pointer: */ … … 72 72 73 73 //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) 75 75 io_index=vertex_id-1; //(C indexing) 76 76 _assert_(vertex_id>0 && vertex_id<=numberofvertices); -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp
r9372 r9405 20 20 21 21 /*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); 24 24 iomodel->FetchData(1,ElementsEnum); 25 25 -
issm/trunk/src/c/modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp
r9370 r9405 24 24 25 25 /*Fetch parameters: */ 26 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);26 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 27 27 28 28 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp
r9370 r9405 20 20 21 21 /*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); 24 24 iomodel->FetchData(1,ElementsEnum); 25 25 -
issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r9370 r9405 27 27 28 28 /*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); 32 32 33 33 /*Now, return if no control*/ … … 42 42 iomodel->FetchData(4,ControlTypeEnum,WeightsEnum,CmMinEnum,CmMaxEnum); 43 43 for(i=0;i<num_control_type;i++){ 44 switch((int)iomodel-> f(ControlTypeEnum)[i]){44 switch((int)iomodel->Data(ControlTypeEnum)[i]){ 45 45 case DhdtEnum: iomodel->FetchData(1,DhdtEnum); break; 46 46 case VxEnum: iomodel->FetchData(1,VxEnum); break; … … 48 48 case DragCoefficientEnum: iomodel->FetchData(1,DragCoefficientEnum); break; 49 49 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])); 51 51 } 52 52 } -
issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r9374 r9405 28 28 29 29 /*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); 34 34 35 35 /*Did we already create the elements? : */ -
issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
r9362 r9405 29 29 30 30 /*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); 35 35 36 36 /*Some checks if debugging*/ -
issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
r9393 r9405 22 22 23 23 /*Initialize dataset: */ 24 parameters = (Parameters*)iomodel->constants->Copy();24 parameters = iomodel->CopyConstants(); 25 25 26 26 /*some parameters that did not come with the iomodel: */ -
issm/trunk/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
r9370 r9405 32 32 33 33 /*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); 38 38 39 39 /*Some checks if debugging*/ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
r9370 r9405 40 40 41 41 /*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); 50 50 51 51 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r9391 r9405 42 42 43 43 /*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); 49 49 50 50 /*Recover pointer: */ … … 177 177 iomodel->FetchData(5,RiftinfoEnum,ThicknessEnum,BedEnum,SurfaceEnum,NodeOnIceShelfEnum); 178 178 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]){ 180 180 loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum)); 181 181 count++; -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp
r9375 r9405 25 25 26 26 /*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); 30 30 31 31 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
r9370 r9405 24 24 25 25 /*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); 32 32 33 33 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp
r9370 r9405 28 28 29 29 /*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); 33 33 34 34 /*Create constraints if they do not exist yet*/ … … 51 51 /*keep only this partition's nodes:*/ 52 52 if((iomodel->my_vertices[i])){ 53 if (!(int)iomodel-> f(NodeOnHutterEnum)[i]){53 if (!(int)iomodel->Data(NodeOnHutterEnum)[i]){ 54 54 55 55 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,DiagnosticHutterAnalysisEnum)); … … 60 60 } 61 61 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. 64 64 count++; 65 65 } 66 66 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 vy67 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 69 69 count++; 70 70 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp
r9370 r9405 25 25 26 26 /*Fetch parameters: */ 27 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);28 iomodel-> constants->FindParam(&ishutter,IshutterEnum);27 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 28 iomodel->Constant(&ishutter,IshutterEnum); 29 29 30 30 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp
r9370 r9405 21 21 22 22 /*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); 25 25 26 26 /*Now, is the flag hutter on? otherwise, do nothing: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r9370 r9405 24 24 25 25 /*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); 29 29 30 30 /*Recover pointer: */ … … 52 52 if(iomodel->my_vertices[i]){ 53 53 54 if ((int)iomodel-> f(NodeOnStokesEnum)[i]){54 if ((int)iomodel->Data(NodeOnStokesEnum)[i]){ 55 55 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 56 56 count++; 57 57 } 58 else if (!isnan(iomodel-> f(SpcvzEnum)[i])){58 else if (!isnan(iomodel->Data(SpcvzEnum)[i])){ 59 59 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. 61 61 count++; 62 62 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp
r9370 r9405 25 25 26 26 /*Fetch parameters: */ 27 iomodel-> constants->FindParam(&dim,DimEnum);28 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);27 iomodel->Constant(&dim,DimEnum); 28 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 29 29 30 30 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp
r9370 r9405 20 20 21 21 /*Fetch parameters: */ 22 iomodel-> constants->FindParam(&dim,DimEnum);23 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);22 iomodel->Constant(&dim,DimEnum); 23 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 24 24 25 25 /*Now, is the model 3d? otherwise, do nothing: */ -
issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r9391 r9405 48 48 49 49 /*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); 57 57 58 58 /*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 26 26 27 27 /*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); 32 32 33 33 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateNodesEnthalpy.cpp
r9372 r9405 24 24 25 25 /*Fetch parameters: */ 26 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);26 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 27 27 28 28 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
r9372 r9405 20 20 21 21 /*Fetch parameters: */ 22 iomodel-> constants->FindParam(&dim,DimEnum);23 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);22 iomodel->Constant(&dim,DimEnum); 23 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 24 24 25 25 /*Now, is the model 3d? otherwise, do nothing: */ -
issm/trunk/src/c/modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp
r9372 r9405 24 24 25 25 /*Fetch parameters: */ 26 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);26 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 27 27 28 28 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp
r9372 r9405 19 19 20 20 /*Fetch data needed: */ 21 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);21 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 22 22 iomodel->FetchData(1,ElementsEnum); 23 23 -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp
r9372 r9405 22 22 23 23 /*Fetch parameters: */ 24 iomodel-> constants->FindParam(&dim,DimEnum);25 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);24 iomodel->Constant(&dim,DimEnum); 25 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 26 26 27 27 /*if 2d: Error*/ … … 40 40 for (i=0;i<numberofvertices;i++){ 41 41 if((iomodel->my_vertices[i]==1)){ 42 if (iomodel-> f(NodeOnBedEnum)[i]){42 if (iomodel->Data(NodeOnBedEnum)[i]){ 43 43 loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,MeltingAnalysisEnum)); 44 44 } -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateNodesMelting.cpp
r9372 r9405 24 24 25 25 /*Fetch parameters: */ 26 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);26 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 27 27 28 28 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp
r9372 r9405 20 20 21 21 /*Fetch parameters: */ 22 iomodel-> constants->FindParam(&dim,DimEnum);23 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);22 iomodel->Constant(&dim,DimEnum); 23 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 24 24 25 25 /*Now, is the model 3d? otherwise, do nothing: */ -
issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
r9362 r9405 37 37 38 38 /*Fetch parameters: */ 39 iomodel-> constants->FindParam(&dim,DimEnum);40 iomodel-> constants->FindParam(&verbose,VerboseEnum);39 iomodel->Constant(&dim,DimEnum); 40 iomodel->Constant(&verbose,VerboseEnum); 41 41 42 42 SetVerbosityLevel(verbose); -
issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
r9362 r9405 42 42 43 43 /*Fetch parameters: */ 44 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);44 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 45 45 46 46 my_nodes=(bool*)xmalloc(numberofvertices*sizeof(bool)); … … 57 57 58 58 /*Fetch parameters: */ 59 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);59 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 60 60 61 61 /*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 … … 78 78 79 79 /*Fetch parameters: */ 80 iomodel-> constants->FindParam(&dim,DimEnum);80 iomodel->Constant(&dim,DimEnum); 81 81 82 82 /*Build discontinuous node partitioning -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
r9362 r9405 13 13 14 14 /*Fetch parameters: */ 15 iomodel-> constants->FindParam(&prognostic_DG,PrognosticDGEnum);15 iomodel->Constant(&prognostic_DG,PrognosticDGEnum); 16 16 17 17 /*Output*/ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
r9387 r9405 27 27 28 28 /*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); 32 32 33 33 /*Recover pointer: */ … … 47 47 48 48 /*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] 50 50 51 51 /*Now, if this element is not in the partition, pass: */ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp
r9383 r9405 30 30 31 31 /*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); 36 36 37 37 /*Recover pointer: */ … … 72 72 73 73 //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) 75 75 io_index=vertex_id-1; //(C indexing) 76 76 _assert_(vertex_id>0 && vertex_id<=numberofvertices); -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
r9372 r9405 21 21 22 22 /*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); 26 26 iomodel->FetchData(1,ElementsEnum); 27 27 -
issm/trunk/src/c/modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp
r9370 r9405 24 24 25 25 /*Fetch parameters: */ 26 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);26 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 27 27 28 28 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/SurfaceSlope/UpdateElementsSurfaceSlope.cpp
r9370 r9405 20 20 21 21 /*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); 24 24 iomodel->FetchData(1,ElementsEnum); 25 25 -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
r9362 r9405 23 23 24 24 /*Fetch parameters: */ 25 iomodel-> constants->FindParam(&dim,DimEnum);25 iomodel->Constant(&dim,DimEnum); 26 26 27 27 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
r9372 r9405 26 26 27 27 /*Fetch parameters: */ 28 iomodel-> constants->FindParam(&dim,DimEnum);29 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);28 iomodel->Constant(&dim,DimEnum); 29 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 30 30 31 31 /*Create loads if they do not exist yet*/ … … 43 43 /*keep only this partition's nodes:*/ 44 44 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! 46 46 loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,ThermalAnalysisEnum)); 47 47 } -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp
r9372 r9405 24 24 25 25 /*Fetch parameters: */ 26 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);26 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 27 27 28 28 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp
r9370 r9405 21 21 22 22 /*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); 26 26 27 27 /*Now, is the model 3d? otherwise, do nothing: */ -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r9320 r9405 26 26 char *outputfilename = NULL; 27 27 char cpu_outputfilename[100]; //easier to convert an integer with sprintf 28 bool io_gather ;28 bool io_gather,results_on_vertices; 29 29 int solutiontype; 30 30 Results *results = NULL; -
issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
r9401 r9405 493 493 else if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum; 494 494 else if (strcmp(name,"NumberOfEdges")==0) return NumberOfEdgesEnum; 495 else if (strcmp(name,"ResultsOnVertices")==0) return ResultsOnVerticesEnum; 495 496 else _error_("Enum %s not found",name); 496 497 -
issm/trunk/src/c/objects/Elements/Penta.cpp
r9392 r9405 57 57 /*Checks in debugging mode*/ 58 58 /*{{{2*/ 59 _assert_(iomodel-> f(UpperelementsEnum));60 _assert_(iomodel-> f(LowerelementsEnum));59 _assert_(iomodel->Data(UpperelementsEnum)); 60 _assert_(iomodel->Data(LowerelementsEnum)); 61 61 /*}}}*/ 62 62 … … 66 66 67 67 /*Build neighbors list*/ 68 if (isnan(iomodel-> f(UpperelementsEnum)[index])) penta_elements_ids[1]=this->id; //upper penta is the same penta69 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 penta71 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]); 72 72 this->InitHookNeighbors(penta_elements_ids); 73 73 74 74 /*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; 77 77 78 78 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. … … 4860 4860 4861 4861 /*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); 4865 4865 4866 4866 /*Branch on type of vector: nodal or elementary: */ … … 4869 4869 /*Recover vertices ids needed to initialize inputs*/ 4870 4870 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 Matlab4871 penta_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab 4872 4872 } 4873 4873 … … 5169 5169 5170 5170 /*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); 5175 5175 5176 5176 /*Checks if debuging*/ 5177 5177 /*{{{2*/ 5178 _assert_(iomodel-> f(ElementsEnum));5178 _assert_(iomodel->Data(ElementsEnum)); 5179 5179 /*}}}*/ 5180 5180 5181 5181 /*Recover vertices ids needed to initialize inputs*/ 5182 5182 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 Matlab5183 penta_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab 5184 5184 } 5185 5185 5186 5186 /*Control Inputs*/ 5187 if (control_analysis && iomodel-> f(ControlTypeEnum)){5187 if (control_analysis && iomodel->Data(ControlTypeEnum)){ 5188 5188 for(i=0;i<num_control_type;i++){ 5189 switch((int)iomodel-> f(ControlTypeEnum)[i]){5189 switch((int)iomodel->Data(ControlTypeEnum)[i]){ 5190 5190 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; 5195 5195 this->inputs->AddInput(new ControlInput(DhdtEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5196 5196 } 5197 5197 break; 5198 5198 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; 5203 5203 this->inputs->AddInput(new ControlInput(VxEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5204 5204 } 5205 5205 break; 5206 5206 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; 5211 5211 this->inputs->AddInput(new ControlInput(VyEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5212 5212 } 5213 5213 break; 5214 5214 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]; 5219 5219 this->inputs->AddInput(new ControlInput(DragCoefficientEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5220 5220 } … … 5223 5223 /*Matice will take care of it*/ break; 5224 5224 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])); 5226 5226 } 5227 5227 } … … 5229 5229 5230 5230 //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){ 5233 5233 this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealApproximationEnum)); 5234 5234 } 5235 else if (*(iomodel-> f(ElementsTypeEnum)+index)==PattynApproximationEnum){5235 else if (*(iomodel->Data(ElementsTypeEnum)+index)==PattynApproximationEnum){ 5236 5236 this->inputs->AddInput(new IntInput(ApproximationEnum,PattynApproximationEnum)); 5237 5237 } 5238 else if (*(iomodel-> f(ElementsTypeEnum)+index)==MacAyealPattynApproximationEnum){5238 else if (*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealPattynApproximationEnum){ 5239 5239 this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealPattynApproximationEnum)); 5240 5240 } 5241 else if (*(iomodel-> f(ElementsTypeEnum)+index)==HutterApproximationEnum){5241 else if (*(iomodel->Data(ElementsTypeEnum)+index)==HutterApproximationEnum){ 5242 5242 this->inputs->AddInput(new IntInput(ApproximationEnum,HutterApproximationEnum)); 5243 5243 } 5244 else if (*(iomodel-> f(ElementsTypeEnum)+index)==StokesApproximationEnum){5244 else if (*(iomodel->Data(ElementsTypeEnum)+index)==StokesApproximationEnum){ 5245 5245 this->inputs->AddInput(new IntInput(ApproximationEnum,StokesApproximationEnum)); 5246 5246 } 5247 else if (*(iomodel-> f(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){5247 else if (*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){ 5248 5248 this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealStokesApproximationEnum)); 5249 5249 } 5250 else if (*(iomodel-> f(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){5250 else if (*(iomodel->Data(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){ 5251 5251 this->inputs->AddInput(new IntInput(ApproximationEnum,PattynStokesApproximationEnum)); 5252 5252 } 5253 else if (*(iomodel-> f(ElementsTypeEnum)+index)==NoneApproximationEnum){5253 else if (*(iomodel->Data(ElementsTypeEnum)+index)==NoneApproximationEnum){ 5254 5254 this->inputs->AddInput(new IntInput(ApproximationEnum,NoneApproximationEnum)); 5255 5255 } 5256 5256 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))); 5258 5258 } 5259 5259 } 5260 5260 5261 5261 /*DatasetInputs*/ 5262 if (control_analysis && iomodel-> f(WeightsEnum)) {5262 if (control_analysis && iomodel->Data(WeightsEnum)) { 5263 5263 5264 5264 /*Create inputs and add to DataSetInput*/ 5265 5265 DatasetInput* datasetinput=new DatasetInput(WeightsEnum); 5266 5266 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]; 5268 5268 datasetinput->inputs->AddObject(new PentaVertexInput(WeightsEnum,nodeinputs)); 5269 5269 } … … 7520 7520 7521 7521 /*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); 7531 7531 7532 7532 7533 7533 /*Checks if debuging*/ 7534 7534 /*{{{2*/ 7535 _assert_(iomodel-> f(ElementsEnum));7535 _assert_(iomodel->Data(ElementsEnum)); 7536 7536 /*}}}*/ 7537 7537 … … 7548 7548 7549 7549 /*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 Matlab7550 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 7551 7551 7552 7552 /*Recover nodes ids needed to initialize the node hook.*/ … … 7554 7554 //go recover node ids, needed to initialize the node hook. 7555 7555 //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 Matlab7556 penta_node_ids[i]=iomodel->nodecounter+(int)iomodel->Data(ElementsEnum)[6*index+i]; //ids for vertices are in the elements array from Matlab 7557 7557 } 7558 7558 … … 7569 7569 7570 7570 /*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; 7573 7573 else for(i=0;i<6;i++)nodeinputs[i]=0; 7574 7574 this->inputs->AddInput(new PentaVertexInput(VxEnum,nodeinputs)); … … 7576 7576 if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVxEnum,nodeinputs)); 7577 7577 } 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; 7580 7580 else for(i=0;i<6;i++)nodeinputs[i]=0; 7581 7581 this->inputs->AddInput(new PentaVertexInput(VyEnum,nodeinputs)); … … 7583 7583 if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVyEnum,nodeinputs)); 7584 7584 } 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; 7587 7587 else for(i=0;i<6;i++)nodeinputs[i]=0; 7588 7588 this->inputs->AddInput(new PentaVertexInput(VzEnum,nodeinputs)); … … 7590 7590 if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVzEnum,nodeinputs)); 7591 7591 } 7592 if(!iomodel-> f(PressureEnum)){7592 if(!iomodel->Data(PressureEnum)){ 7593 7593 for(i=0;i<6;i++)nodeinputs[i]=0; 7594 7594 if(qmu_analysis){ … … 7601 7601 } 7602 7602 } 7603 if(*(iomodel-> f(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){7603 if(*(iomodel->Data(ElementsTypeEnum)+index)==PattynStokesApproximationEnum){ 7604 7604 /*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]; 7607 7607 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]); 7609 7609 this->inputs->AddInput(new PentaVertexInput(VzPattynEnum,nodeinputs)); 7610 7610 } … … 7615 7615 } 7616 7616 } 7617 if(*(iomodel-> f(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){7617 if(*(iomodel->Data(ElementsTypeEnum)+index)==MacAyealStokesApproximationEnum){ 7618 7618 /*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]; 7621 7621 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]); 7623 7623 this->inputs->AddInput(new PentaVertexInput(VzMacAyealEnum,nodeinputs)); 7624 7624 } … … 7645 7645 this->inputs->AddInput(new PentaVertexInput(VyMeshEnum,nodeinputs)); 7646 7646 this->inputs->AddInput(new PentaVertexInput(VzMeshEnum,nodeinputs)); 7647 if (iomodel-> f(TemperatureEnum) && iomodel->f(WaterfractionEnum)) {7647 if (iomodel->Data(TemperatureEnum) && iomodel->Data(WaterfractionEnum)) { 7648 7648 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); 7651 7651 } 7652 7652 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]; 7655 7655 } 7656 7656 this->inputs->AddInput(new PentaVertexInput(EnthalpyEnum,nodeinputs)); -
issm/trunk/src/c/objects/Elements/PentaHook.cpp
r9362 r9405 51 51 52 52 /*retrieve parameters: */ 53 iomodel-> constants->FindParam(&matpar_id,NumberOfElementsEnum); matpar_id++;53 iomodel->Constant(&matpar_id,NumberOfElementsEnum); matpar_id++; 54 54 55 55 this->numanalyses=in_numanalyses; -
issm/trunk/src/c/objects/Elements/Tria.cpp
r9402 r9405 52 52 53 53 /*Build horizontalneighborsids list: */ 54 _assert_(iomodel-> f(ElementconnectivityEnum));54 _assert_(iomodel->Data(ElementconnectivityEnum)); 55 55 //for (i=0;i<3;i++) this->horizontalneighborsids[i]=(int)iomodel->elementconnectivity[3*index+i]-1; 56 56 … … 3279 3279 3280 3280 /*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); 3285 3285 3286 3286 /*Recover vertices ids needed to initialize inputs*/ 3287 3287 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 Matlab3288 tria_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab 3289 3289 } 3290 3290 3291 3291 /*Control Inputs*/ 3292 if (control_analysis && iomodel-> f(ControlTypeEnum)){3292 if (control_analysis && iomodel->Data(ControlTypeEnum)){ 3293 3293 for(i=0;i<num_control_type;i++){ 3294 switch((int)iomodel-> f(ControlTypeEnum)[i]){3294 switch((int)iomodel->Data(ControlTypeEnum)[i]){ 3295 3295 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; 3300 3300 this->inputs->AddInput(new ControlInput(DhdtEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3301 3301 } 3302 3302 break; 3303 3303 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; 3308 3308 this->inputs->AddInput(new ControlInput(VxEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3309 3309 } 3310 3310 break; 3311 3311 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; 3316 3316 this->inputs->AddInput(new ControlInput(VyEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3317 3317 } 3318 3318 break; 3319 3319 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]; 3324 3324 this->inputs->AddInput(new ControlInput(DragCoefficientEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3325 3325 } … … 3328 3328 /*Matice will take care of it*/ break; 3329 3329 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])); 3331 3331 } 3332 3332 } … … 3334 3334 3335 3335 /*DatasetInputs*/ 3336 if (control_analysis && iomodel-> f(WeightsEnum)){3336 if (control_analysis && iomodel->Data(WeightsEnum)){ 3337 3337 3338 3338 /*Create inputs and add to DataSetInput*/ 3339 3339 DatasetInput* datasetinput=new DatasetInput(WeightsEnum); 3340 3340 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]; 3342 3342 datasetinput->inputs->AddObject(new TriaVertexInput(WeightsEnum,nodeinputs)); 3343 3343 } … … 3906 3906 3907 3907 /*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); 3911 3911 3912 3912 /*Branch on type of vector: nodal or elementary: */ … … 3915 3915 /*Recover vertices ids needed to initialize inputs*/ 3916 3916 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 Matlab3917 tria_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab 3918 3918 } 3919 3919 … … 5223 5223 /*Checks if debuging*/ 5224 5224 /*{{{2*/ 5225 _assert_(iomodel-> f(ElementsEnum));5225 _assert_(iomodel->Data(ElementsEnum)); 5226 5226 /*}}}*/ 5227 5227 5228 5228 /*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); 5232 5232 5233 5233 /*Recover element type*/ … … 5244 5244 /*Recover vertices ids needed to initialize inputs*/ 5245 5245 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 Matlab5246 tria_vertex_ids[i]=(int)iomodel->Data(ElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab 5247 5247 } 5248 5248 … … 5257 5257 /*Continuous Galerkin*/ 5258 5258 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 Matlab5259 tria_node_ids[i]=iomodel->nodecounter+(int)*(iomodel->Data(ElementsEnum)+3*index+i); //ids for vertices are in the elements array from Matlab 5260 5260 } 5261 5261 } … … 5273 5273 5274 5274 /*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; 5277 5277 else for(i=0;i<3;i++)nodeinputs[i]=0; 5278 5278 this->inputs->AddInput(new TriaVertexInput(VxEnum,nodeinputs)); … … 5280 5280 if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVxEnum,nodeinputs)); 5281 5281 } 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; 5284 5284 else for(i=0;i<3;i++)nodeinputs[i]=0; 5285 5285 this->inputs->AddInput(new TriaVertexInput(VyEnum,nodeinputs)); … … 5287 5287 if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVyEnum,nodeinputs)); 5288 5288 } 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; 5291 5291 else for(i=0;i<3;i++)nodeinputs[i]=0; 5292 5292 this->inputs->AddInput(new TriaVertexInput(VzEnum,nodeinputs)); … … 5294 5294 if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVzEnum,nodeinputs)); 5295 5295 } 5296 if(!iomodel-> f(PressureEnum)){5296 if(!iomodel->Data(PressureEnum)){ 5297 5297 for(i=0;i<3;i++)nodeinputs[i]=0; 5298 5298 if(qmu_analysis){ -
issm/trunk/src/c/objects/Elements/TriaHook.cpp
r9362 r9405 49 49 50 50 /*retrieve parameters: */ 51 iomodel-> constants->FindParam(&matpar_id,NumberOfElementsEnum); matpar_id++;51 iomodel->Constant(&matpar_id,NumberOfElementsEnum); matpar_id++; 52 52 53 53 this->numanalyses=in_numanalyses; -
issm/trunk/src/c/objects/IoModel.cpp
r9393 r9405 46 46 /*Initialize and read constants:*/ 47 47 this->constants=new Parameters(); 48 this->Fetch Parameters(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*/ 49 49 50 50 /*Initialize data: */ … … 62 62 this->loadcounter=0; 63 63 this->constraintcounter=0; 64 65 64 } 66 65 /*}}}*/ … … 71 70 72 71 /*Some checks in debugging mode*/ 73 #ifdef _ISSM_DEBUG_72 #ifdef _ISSM_DEBUG_ 74 73 for(int i=0;i<MaximumNumberOfEnums;i++){ 75 74 if(this->data[i]){ … … 77 76 } 78 77 } 79 #endif78 #endif 80 79 81 80 xfree((void**)&this->data); … … 88 87 } 89 88 /*}}}*/ 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*/ 91 void 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*/ 100 void 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*/ 109 void 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*/ 118 Parameters* IoModel::CopyConstants(void){ 119 120 _assert_(this->constants); 121 return (Parameters*)this->constants->Copy(); 122 } 123 /*}}}*/ 124 /*FUNCTION IoModel::Data{{{1*/ 125 double* 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*/ 518 134 void IoModel::DeleteData(int num,...){ 519 135 … … 524 140 525 141 /*Go through the entire list of enums and delete the corresponding data from the iomodel-data dataset: */ 526 142 527 143 va_start(ap,num); 528 144 for(i = 0; i <num; i++){ … … 533 149 va_end(ap); 534 150 } /*}}}*/ 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*/ 152 void IoModel::FetchConstants(void){ 544 153 545 154 extern int my_rank; … … 558 167 int string_size; 559 168 560 169 /*Check that some fields have been allocated*/ 170 _assert_(this->fid); 171 _assert_(this->constants); 172 561 173 /*Go find in the binary file, the position of the data we want to fetch: */ 562 174 if(my_rank==0){ //cpu 0{{{2 … … 595 207 596 208 /*create BoolParam: */ 597 parameters->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to boolean209 this->constants->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to boolean 598 210 599 211 break; … … 604 216 605 217 /*create IntParam: */ 606 parameters->AddObject(new IntParam(record_enum,integer));218 this->constants->AddObject(new IntParam(record_enum,integer)); 607 219 608 220 break; … … 613 225 614 226 /*create DoubleParam: */ 615 parameters->AddObject(new DoubleParam(record_enum,scalar));227 this->constants->AddObject(new DoubleParam(record_enum,scalar)); 616 228 617 229 break; … … 635 247 636 248 /*Add string to parameters: */ 637 parameters->AddObject(new StringParam(record_enum,string));249 this->constants->AddObject(new StringParam(record_enum,string)); 638 250 639 251 /*Free string*/ … … 696 308 697 309 /*create BoolParam: */ 698 parameters->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to a boolean310 this->constants->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to a boolean 699 311 break; 700 312 … … 704 316 705 317 /*create IntParam: */ 706 parameters->AddObject(new IntParam(record_enum,integer));318 this->constants->AddObject(new IntParam(record_enum,integer)); 707 319 708 320 break; … … 712 324 713 325 /*create DoubleParam: */ 714 parameters->AddObject(new DoubleParam(record_enum,scalar));326 this->constants->AddObject(new DoubleParam(record_enum,scalar)); 715 327 716 328 break; … … 729 341 } 730 342 /*Add string to parameters: */ 731 parameters->AddObject(new StringParam(record_enum,string));343 this->constants->AddObject(new StringParam(record_enum,string)); 732 344 733 345 break; … … 749 361 } 750 362 /*}}}*/ 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*/ 364 void IoModel::FetchData(bool* pboolean,int data_enum){ 753 365 754 366 extern int my_rank; 755 367 extern int num_procs; 756 368 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*/ 392 void 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*/ 420 void 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: */ 764 437 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*/ 448 void 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*/ 495 void 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*/ 564 void 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*/ 611 void 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++){ 777 645 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); 788 659 } 789 660 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*/ 675 void 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*/ 756 void 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*/ 813 791 void IoModel::FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum,double default_value){ 814 792 … … 1005 983 xfree((void**)&string); 1006 984 } 985 /*FUNCTION IoModel::SetFilePointerToData{{{1*/ 986 FILE* 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 17 17 18 18 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.* 21 22 22 23 public: 23 Parameters *constants; //this dataset holds all double, int, bool and char*parameters read in from the input file.*24 25 24 /*This data needs to stay memory resident at all time, even if it's memory intensive: */ 26 25 bool *my_elements; … … 35 34 int constraintcounter; //keep track of how many constraints are being created in each analysis type 36 35 37 /*Methods : {{{1*/36 /*Methods*/ 38 37 ~IoModel(); 39 38 IoModel(); 40 39 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 /*}}}*/58 40 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); 59 60 }; 60 61 -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r9386 r9405 54 54 55 55 /*find parameters: */ 56 iomodel-> constants->FindParam(&dim,DimEnum);57 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);56 iomodel->Constant(&dim,DimEnum); 57 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 58 58 59 59 /*First, retrieve element index and element type: */ … … 64 64 segment_width=6; 65 65 } 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) 68 68 69 69 /*Build ids for hook constructors: */ 70 icefront_eid=(int) *(iomodel-> f(PressureloadEnum)+segment_width*i+segment_width-2); //matlab indexing70 icefront_eid=(int) *(iomodel->Data(PressureloadEnum)+segment_width*i+segment_width-2); //matlab indexing 71 71 icefront_mparid=numberofelements+1; //matlab indexing 72 72 73 73 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); 76 76 } 77 77 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); 82 82 } 83 83 else _error_("in_icefront_type %s not supported yet!",EnumToStringx(in_icefront_type)); … … 85 85 if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum) num_nodes=4; 86 86 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); 88 88 89 89 /*Ok, we have everything to build the object: */ -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r9362 r9405 54 54 55 55 /*Fetch parameters: */ 56 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);56 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 57 57 58 58 /* Get MatPar id */ … … 60 60 61 61 /*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] 63 63 /* Boundary edge, only one element */ 64 e1=(int)iomodel-> f(EdgesEnum)[4*i+2];64 e1=(int)iomodel->Data(EdgesEnum)[4*i+2]; 65 65 e2=(int)UNDEF; 66 66 num_elems=1; … … 71 71 else{ 72 72 /* 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]; 75 75 num_elems=2; 76 76 num_nodes=4; … … 81 81 82 82 /*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]; 85 85 86 86 if (numericalflux_type==InternalEnum){ … … 91 91 pos1=pos2=pos3=pos4=UNDEF; 92 92 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; 97 97 } 98 98 _assert_(pos1!=UNDEF && pos2!=UNDEF && pos3!=UNDEF && pos4!=UNDEF); … … 110 110 pos1=pos2=UNDEF; 111 111 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; 114 114 } 115 115 _assert_(pos1!=UNDEF && pos2!=UNDEF); -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r9362 r9405 53 53 54 54 /*Fetch parameters: */ 55 iomodel-> constants->FindParam(&numberofvertices,NumberOfVerticesEnum);56 iomodel-> constants->FindParam(&numberofelements,NumberOfElementsEnum);55 iomodel->Constant(&numberofvertices,NumberOfVerticesEnum); 56 iomodel->Constant(&numberofelements,NumberOfElementsEnum); 57 57 58 58 /*Some checks if debugging activated*/ -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r9362 r9405 56 56 57 57 /*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); 60 60 61 61 /*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); 67 67 68 68 /*id: */ … … 89 89 this->penalty_lock=penalty_lock; 90 90 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); 96 96 97 97 //intialize inputs, and add as many inputs per element as requested: … … 99 99 100 100 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]; 105 105 106 106 this->inputs->AddInput(new IntInput(TypeEnum,riftfront_type)); -
issm/trunk/src/c/objects/Materials/Matice.cpp
r9380 r9405 660 660 661 661 /*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); 665 665 666 666 /*if 2d*/ … … 674 674 675 675 /*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)]; 678 678 this->inputs->AddInput(new TriaVertexInput(RheologyBbarEnum,nodeinputs)); 679 679 } 680 680 681 681 /*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]; 684 684 this->inputs->AddInput(new TriaVertexInput(RheologyNEnum,nodeinputs)); 685 685 } 686 686 687 687 /*Control Inputs*/ 688 if (control_analysis && iomodel-> f(ControlTypeEnum)){688 if (control_analysis && iomodel->Data(ControlTypeEnum)){ 689 689 for(i=0;i<num_control_type;i++){ 690 switch((int)iomodel-> f(ControlTypeEnum)[i]){690 switch((int)iomodel->Data(ControlTypeEnum)[i]){ 691 691 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]; 697 697 this->inputs->AddInput(new ControlInput(RheologyBbarEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 698 698 } … … 713 713 714 714 /*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)]; 717 717 this->inputs->AddInput(new PentaVertexInput(RheologyBEnum,nodeinputs)); 718 718 } 719 719 720 720 /*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]; 723 723 this->inputs->AddInput(new PentaVertexInput(RheologyNEnum,nodeinputs)); 724 724 } 725 725 726 726 /*Control Inputs*/ 727 if (control_analysis && iomodel-> f(ControlTypeEnum)){727 if (control_analysis && iomodel->Data(ControlTypeEnum)){ 728 728 for(i=0;i<num_control_type;i++){ 729 switch((int)iomodel-> f(ControlTypeEnum)[i]){729 switch((int)iomodel->Data(ControlTypeEnum)[i]){ 730 730 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]; 736 736 this->inputs->AddInput(new ControlInput(RheologyBEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 737 737 } -
issm/trunk/src/c/objects/Materials/Matpar.cpp
r9362 r9405 26 26 27 27 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); 45 45 } 46 46 /*}}}1*/ -
issm/trunk/src/c/objects/Node.cpp
r9380 r9405 37 37 38 38 /*Fetch parameters: */ 39 iomodel-> constants->FindParam(&dim,DimEnum);39 iomodel->Constant(&dim,DimEnum); 40 40 41 41 /*id: */ … … 46 46 47 47 /*indexing:*/ 48 DistributeNumDofs(&this->indexing,analysis_type,iomodel-> f(VerticesTypeEnum)+io_index); //number of dofs per node48 DistributeNumDofs(&this->indexing,analysis_type,iomodel->Data(VerticesTypeEnum)+io_index); //number of dofs per node 49 49 gsize=this->indexing.gsize; 50 50 … … 54 54 //intialize inputs, and add as many inputs per element as requested: 55 55 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])); 60 60 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])); 62 62 63 63 /*set single point constraints: */ 64 64 65 65 /*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]){ 68 68 for(k=1;k<=gsize;k++){ 69 69 this->FreezeDof(k); … … 75 75 if (dim==3){ 76 76 /*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]){ 80 80 for(k=1;k<=gsize;k++) this->FreezeDof(k); 81 81 } 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]){ 84 84 for(k=1;k<=gsize;k++) this->FreezeDof(k); 85 85 } 86 86 } 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]){ 89 89 for(k=1;k<=2;k++) this->FreezeDof(k); 90 90 } … … 92 92 } 93 93 /*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]){ 96 96 for(k=1;k<=gsize;k++){ 97 97 this->FreezeDof(k); … … 104 104 if (analysis_type==DiagnosticHutterAnalysisEnum){ 105 105 /*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]){ 108 108 for(k=1;k<=gsize;k++){ 109 109 this->FreezeDof(k); … … 122 122 if (dim==3){ 123 123 /*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]){ 126 126 for(k=1;k<=gsize;k++){ 127 127 this->FreezeDof(k); -
issm/trunk/src/c/objects/Vertex.cpp
r9362 r9405 31 31 Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel){ 32 32 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])); 34 34 35 35 } -
issm/trunk/src/m/classes/model.m
r9401 r9405 253 253 %Results fields 254 254 output_frequency = {0,true,'Integer'}; 255 results_on_vertices = {0,true,'Boolean'}; 255 256 inputfilename = {'',true,'String'}; 256 257 outputfilename = {'',true,'String'};
Note:
See TracChangeset
for help on using the changeset viewer.