Changeset 9356
- Timestamp:
- 08/19/11 18:04:03 (14 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 104 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Parameters.cpp
r9320 r9356 430 430 } 431 431 /*}}}*/ 432 /*FUNCTION Parameters::UnitConversion(int direction_enum);{{{1*/ 433 void Parameters::UnitConversion(int direction_enum){ 434 435 vector<Object*>::iterator object; 436 Param* param=NULL; 437 438 for ( object=objects.begin() ; object < objects.end(); object++ ){ 439 param=(Param*)(*object); 440 param->UnitConversion(direction_enum); 441 } 442 443 } 444 /*}}}*/ 432 445 433 446 /*FUNCTION Parameters::FindParamObject{{{1*/ -
issm/trunk/src/c/Container/Parameters.h
r8600 r9356 54 54 void SetParam(Mat mat,int enum_type); 55 55 void SetParam(FILE* fid,int enum_type); 56 void UnitConversion(int direction_enum); 56 57 57 58 Object* FindParamObject(int enum_type); -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r9291 r9356 177 177 AdjointzEnum, 178 178 AdjointpEnum, 179 ArtDiffEnum,179 Fake35Enum, 180 180 BedEnum, 181 181 BathymetryEnum, … … 187 187 Fake2Enum, 188 188 ConstantEnum, 189 NumControlsEnum,189 Fake37Enum, 190 190 ControlTypeEnum, 191 191 ConvergedEnum, … … 400 400 QmuInNameEnum, 401 401 QmuMassFluxSegmentsEnum, 402 QmuNPartEnum,402 Fake39Enum, 403 403 QmuOutNameEnum, 404 404 QmuPartEnum, … … 422 422 FsetEnum, 423 423 SsetEnum, 424 Grounding LineMigrationEnum,424 GroundinglineMigrationEnum, 425 425 YtsEnum, 426 426 /*}}}*/ … … 458 458 VelAbsGradientEnum, 459 459 DatasetInputEnum, 460 NumResponsesEnum,460 Fake38Enum, 461 461 StepResponsesEnum, 462 462 IntMatParamEnum, … … 489 489 NodeOnHutterEnum, 490 490 ZEnum, 491 GlMigrationEnum,491 Fake36Enum, 492 492 RiftinfoEnum, 493 493 ElementOnIceSheetEnum, -
issm/trunk/src/c/EnumDefinitions/EnumToModelField.cpp
r8926 r9356 22 22 case VyEnum : return "vy"; 23 23 case VyObsEnum : return "vy_obs"; 24 case GroundingLineMigrationEnum : return "gl_migration";25 24 case BasalMeltingRateEnum : return "basal_melting_rate"; 26 25 case SurfaceAccumulationRateEnum : return "surface_accumulation_rate"; -
issm/trunk/src/c/include/typedefs.h
r6413 r9356 11 11 #define SQRT3 1.732050807568877293527446341505872366942805253810380628055806979 12 12 #define PI 3.141592653589793238462643383279502884197169399375105820974944592308 13 #define YTS 365.0*24.0*3600.0 13 14 14 15 #define NDOF1 1 -
issm/trunk/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
r9320 r9356 24 24 int dummy; 25 25 26 int qmu_npart;26 int npart; 27 27 double *qmu_part = NULL; 28 28 int numberofvertices; … … 39 39 /*Some parameters: */ 40 40 numberofvertices=vertices->NumberOfVertices(); 41 parameters->FindParam(& qmu_npart,QmuNPartEnum);41 parameters->FindParam(&npart,NpartEnum); 42 42 43 43 /*average onto the separate areas. The result will be a npart sized vector. */ 44 44 45 45 /*allocate: */ 46 partition_contributions=NewVec( qmu_npart);47 partition_areas=NewVec( qmu_npart);48 vec_average=NewVec( qmu_npart);46 partition_contributions=NewVec(npart); 47 partition_areas=NewVec(npart); 48 vec_average=NewVec(npart); 49 49 50 50 /*loop on each element, and add contribution of the element to the partition (surface weighted average): */ -
issm/trunk/src/c/modules/CostFunctionx/CostFunctionx.cpp
r8649 r9356 24 24 25 25 /*Recover parameters*/ 26 parameters->FindParam(&num_responses,Num ResponsesEnum);26 parameters->FindParam(&num_responses,NumCmResponsesEnum); 27 27 parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 28 28 -
issm/trunk/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp
r9320 r9356 36 36 37 37 /*retrieve npart: */ 38 parameters->FindParam(&npart, QmuNPartEnum);38 parameters->FindParam(&npart,NpartEnum); 39 39 40 40 /*save the d_responses pointer: */ -
issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
r9291 r9356 145 145 case AdjointzEnum : return "Adjointz"; 146 146 case AdjointpEnum : return "Adjointp"; 147 case ArtDiffEnum : return "ArtDiff";147 case Fake35Enum : return "Fake35"; 148 148 case BedEnum : return "Bed"; 149 149 case BathymetryEnum : return "Bathymetry"; … … 155 155 case Fake2Enum : return "Fake2"; 156 156 case ConstantEnum : return "Constant"; 157 case NumControlsEnum : return "NumControls";157 case Fake37Enum : return "Fake37"; 158 158 case ControlTypeEnum : return "ControlType"; 159 159 case ConvergedEnum : return "Converged"; … … 350 350 case QmuInNameEnum : return "QmuInName"; 351 351 case QmuMassFluxSegmentsEnum : return "QmuMassFluxSegments"; 352 case QmuNPartEnum : return "QmuNPart";352 case Fake39Enum : return "Fake39"; 353 353 case QmuOutNameEnum : return "QmuOutName"; 354 354 case QmuPartEnum : return "QmuPart"; … … 372 372 case FsetEnum : return "Fset"; 373 373 case SsetEnum : return "Sset"; 374 case Grounding LineMigrationEnum : return "GroundingLineMigration";374 case GroundinglineMigrationEnum : return "GroundinglineMigration"; 375 375 case YtsEnum : return "Yts"; 376 376 case TriangleInterpEnum : return "TriangleInterp"; … … 401 401 case VelAbsGradientEnum : return "VelAbsGradient"; 402 402 case DatasetInputEnum : return "DatasetInput"; 403 case NumResponsesEnum : return "NumResponses";403 case Fake38Enum : return "Fake38"; 404 404 case StepResponsesEnum : return "StepResponses"; 405 405 case IntMatParamEnum : return "IntMatParam"; … … 431 431 case NodeOnHutterEnum : return "NodeOnHutter"; 432 432 case ZEnum : return "Z"; 433 case GlMigrationEnum : return "GlMigration";433 case Fake36Enum : return "Fake36"; 434 434 case RiftinfoEnum : return "Riftinfo"; 435 435 case ElementOnIceSheetEnum : return "ElementOnIceSheet"; -
issm/trunk/src/c/modules/GroundingLineMigrationx/GroundingLineMigrationx.cpp
r9211 r9356 19 19 20 20 /*retrieve parameters: */ 21 parameters->FindParam(&migration_style,Grounding LineMigrationEnum);21 parameters->FindParam(&migration_style,GroundinglineMigrationEnum); 22 22 23 23 /*call different migration modules, according to user wishes: */ -
issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
r9339 r9356 16 16 17 17 int numberofvertices; 18 int qmu_npart;18 int npart; 19 19 double *qmu_part = NULL; 20 20 … … 25 25 26 26 /*retrieve parameters: */ 27 parameters->FindParam(& qmu_npart,QmuNPartEnum);27 parameters->FindParam(&npart,NpartEnum); 28 28 parameters->FindParam(&qmu_part,&dummy,QmuPartEnum); 29 29 numberofvertices=vertices->NumberOfVertices(); … … 40 40 41 41 /*Variable is scaled. Determine root name of variable (ex: scaled_DragCoefficient_1 -> DragCoefficient). Allocate distributed_values and fill the 42 * distributed_values with the next qmu_npart variables: */42 * distributed_values with the next npart variables: */ 43 43 44 44 //strcpy(root,strstr(descriptor,"_")+1); *strstr(root,"_")='\0'; … … 47 47 48 48 49 distributed_values=(double*)xmalloc( qmu_npart*sizeof(double));50 for(j=0;j< qmu_npart;j++){49 distributed_values=(double*)xmalloc(npart*sizeof(double)); 50 for(j=0;j<npart;j++){ 51 51 distributed_values[j]=variables[i+j]; 52 52 } … … 76 76 77 77 /*increment i to skip the distributed values just collected: */ 78 i+= qmu_npart-1; //careful, the for loop will add 1.78 i+=npart-1; //careful, the for loop will add 1. 79 79 80 80 /*Free allocations: */ -
issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
r9340 r9356 26 26 bool spcpresent=false; 27 27 int count=0; 28 int numberofvertices; 28 29 29 30 /*variables being fetched: */ … … 31 32 int M,N; 32 33 34 /*Fetch parameters: */ 35 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 33 36 34 37 /*First of, find the record for the enum, and get code of data type: */ … … 42 45 43 46 /*Transient or static?:*/ 44 if(M== iomodel->numberofvertices){47 if(M==numberofvertices){ 45 48 /*static: just create Constraints objects*/ 46 49 count=0; 47 50 48 51 /*Create Constraints from x,y,z: */ 49 for (i=0;i< iomodel->numberofvertices;i++){52 for (i=0;i<numberofvertices;i++){ 50 53 51 54 /*keep only this partition's nodes:*/ … … 60 63 } 61 64 } 62 else if (M== iomodel->numberofvertices+1){65 else if (M==(numberofvertices+1)){ 63 66 /*transient: create transient SpcTransient objects. Same logic, except we need to retrieve 64 67 * various times and values to initialize an SpcTransient object: */ … … 74 77 75 78 /*Create constraints from x,y,z: */ 76 for (i=0;i< iomodel->numberofvertices;i++){79 for (i=0;i<numberofvertices;i++){ 77 80 78 81 /*keep only this partition's nodes:*/ -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp
r9340 r9356 10 10 void CreateConstraintsBalancethickness(Constraints** pconstraints, IoModel* iomodel){ 11 11 12 int prognostic_DG; 13 14 /*Fetch parameters: */ 15 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 16 12 17 /*Output*/ 13 18 Constraints* constraints = NULL; … … 20 25 21 26 /*Do not add constraints in DG*/ 22 if(! iomodel->prognostic_DG){27 if(!prognostic_DG){ 23 28 IoModelToConstraintsx(constraints,iomodel,SpcthicknessEnum,BalancethicknessAnalysisEnum); 24 29 } -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp
r9340 r9356 16 16 int i; 17 17 int element; 18 int prognostic_DG; 19 int numberofedges; 20 21 /*Fetch parameters: */ 22 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 18 23 19 24 /*Output*/ … … 27 32 28 33 /*Loads only in DG*/ 29 if ( iomodel->prognostic_DG){34 if (prognostic_DG){ 30 35 31 36 /*Get edges and elements*/ 32 iomodel->FetchData(&iomodel->edges,& iomodel->numberofedges,NULL,EdgesEnum);37 iomodel->FetchData(&iomodel->edges,&numberofedges,NULL,EdgesEnum); 33 38 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 34 39 iomodel->FetchData(&iomodel->thickness,NULL,NULL,ThicknessEnum); 35 40 36 41 /*First load data:*/ 37 for (i=0;i< iomodel->numberofedges;i++){42 for (i=0;i<numberofedges;i++){ 38 43 39 44 /*Get left and right elements*/ -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp
r9340 r9356 21 21 int io_index; 22 22 bool continuous_galerkin=true; 23 int dim; 24 int numberofelements; 25 int numberofvertices; 26 int prognostic_DG; 23 27 24 28 /*DataSets: */ 25 29 Nodes* nodes = NULL; 30 31 /*Fetch parameters: */ 32 iomodel->parameters->FindParam(&dim,DimEnum); 33 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 34 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 35 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 26 36 27 37 /*Recover pointer: */ … … 32 42 33 43 /*Continuous Galerkin partition of nodes: */ 34 if( iomodel->prognostic_DG) continuous_galerkin=false;44 if(prognostic_DG) continuous_galerkin=false; 35 45 NodesPartitioning(&iomodel->my_nodes,iomodel->my_elements,iomodel->my_vertices,iomodel,continuous_galerkin); 36 46 37 47 /*Check in 3d*/ 38 if( iomodel->prognostic_DG && iomodel->dim==3) _error_("DG 3d not implemented yet");48 if(prognostic_DG && dim==3) _error_("DG 3d not implemented yet"); 39 49 40 50 /*First fetch data: */ … … 50 60 51 61 /*Build Nodes dataset (Continuous Galerkin)*/ 52 for (i=0;i< iomodel->numberofvertices;i++){62 for (i=0;i<numberofvertices;i++){ 53 63 54 64 if(iomodel->my_vertices[i]){ … … 63 73 64 74 /*Build Nodes dataset -> 3 for each element (Discontinuous Galerkin)*/ 65 for (i=0;i< iomodel->numberofelements;i++){75 for (i=0;i<numberofelements;i++){ 66 76 for (j=0;j<3;j++){ 67 77 … … 71 81 vertex_id=(int)*(iomodel->elements+3*i+j); //(Matlab indexing) 72 82 io_index=vertex_id-1; //(C indexing) 73 _assert_(vertex_id>0 && vertex_id<= iomodel->numberofvertices);83 _assert_(vertex_id>0 && vertex_id<=numberofvertices); 74 84 75 85 //Compute Node id -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp
r9343 r9356 16 16 void UpdateElementsBalancethickness(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 18 21 /*Fetch data needed: */ 22 iomodel->parameters->FindParam(&dim,DimEnum); 19 23 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 24 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 20 25 21 26 /*Update elements: */ 22 27 int counter=0; 23 for(int i=0;i< iomodel->numberofelements;i++){28 for(int i=0;i<numberofelements;i++){ 24 29 if(iomodel->my_elements[i]){ 25 30 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 42 47 iomodel->FetchDataToInput(elements,DhdtEnum); 43 48 44 if ( iomodel->dim==3){49 if (dim==3){ 45 50 iomodel->FetchDataToInput(elements,ElementOnBedEnum); 46 51 iomodel->FetchDataToInput(elements,ElementOnSurfaceEnum); -
issm/trunk/src/c/modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 20 21 21 22 /*DataSets: */ 22 23 Nodes* nodes = NULL; 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 23 27 24 28 /*Recover pointer: */ … … 39 43 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 40 44 41 for (i=0;i< iomodel->numberofvertices;i++){45 for (i=0;i<numberofvertices;i++){ 42 46 43 47 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp
r9343 r9356 16 16 void UpdateElementsBedSlope(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 18 21 /*Fetch data needed: */ 22 iomodel->parameters->FindParam(&dim,DimEnum); 19 23 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 24 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 20 25 21 26 /*Update elements: */ 22 27 int counter=0; 23 for(int i=0;i< iomodel->numberofelements;i++){28 for(int i=0;i<numberofelements;i++){ 24 29 if(iomodel->my_elements[i]){ 25 30 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 33 38 iomodel->FetchDataToInput(elements,ElementOnWaterEnum); 34 39 35 if ( iomodel->dim==3){40 if (dim==3){ 36 41 iomodel->FetchDataToInput(elements,ElementOnBedEnum); 37 42 iomodel->FetchDataToInput(elements,ElementOnSurfaceEnum); -
issm/trunk/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
r9340 r9356 14 14 void CreateParametersControl(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type){ 15 15 16 int i;16 int i; 17 17 Parameters* parameters=NULL; 18 bool control_analysis=false; 19 int nsteps; 20 int num_control_type; 21 int num_cm_responses; 22 int* control_type=NULL; 18 23 19 24 /*Get parameters: */ 20 25 parameters=*pparameters; 21 parameters->AddObject(new BoolParam(ControlAnalysisEnum,iomodel->control_analysis));22 26 23 if(iomodel->control_analysis){ 27 /*retrieve some parameters: */ 28 parameters->FindParam(&control_analysis,ControlAnalysisEnum); 24 29 25 /*How many controls and how many responses?*/ 26 parameters->AddObject(new IntParam(NumControlsEnum,iomodel->num_control_type)); 27 parameters->AddObject(new IntParam(NumResponsesEnum,iomodel->num_cm_responses)); 30 if(control_analysis){ 28 31 29 32 /*What control type?*/ 30 iomodel->FetchData(& iomodel->control_type,NULL,NULL,ControlTypeEnum);31 parameters->AddObject(new IntVecParam(ControlTypeEnum, iomodel->control_type,iomodel->num_control_type));32 xfree((void**)& iomodel->control_type);33 iomodel->FetchData(&control_type,&num_control_type,NULL,ControlTypeEnum); 34 parameters->AddObject(new IntVecParam(ControlTypeEnum,control_type,num_control_type)); 35 xfree((void**)&control_type); 33 36 34 37 /*What solution type?*/ … … 39 42 parameters->AddObject(new BoolParam(ControlSteadyEnum,false)); 40 43 } 41 parameters->AddObject(new IntParam(NstepsEnum,iomodel->nsteps));42 parameters->AddObject(new DoubleParam(TolxEnum,iomodel->tolx));43 parameters->AddObject(new DoubleParam(EpsCmEnum,iomodel->eps_cm));44 parameters->AddObject(new DoubleParam(MeanvelEnum,iomodel->meanvel));45 46 parameters->AddObject(new BoolParam(CmGradientEnum,iomodel->cm_gradient));47 44 48 45 /*Now, recover fit, optscal and maxiter as vectors: */ 49 iomodel->FetchData(&iomodel->cm_responses, NULL,NULL,CmResponsesEnum);50 iomodel->FetchData(&iomodel->cm_jump, NULL,NULL,CmJumpEnum);46 iomodel->FetchData(&iomodel->cm_responses,&nsteps,&num_control_type,CmResponsesEnum); 47 iomodel->FetchData(&iomodel->cm_jump,&nsteps,&num_cm_responses,CmJumpEnum); 51 48 iomodel->FetchData(&iomodel->optscal,NULL,NULL,OptscalEnum); 52 49 iomodel->FetchData(&iomodel->maxiter,NULL,NULL,MaxiterEnum); 53 50 54 parameters->AddObject(new DoubleMatParam(OptscalEnum,iomodel->optscal, iomodel->nsteps,iomodel->num_control_type));55 parameters->AddObject(new DoubleMatParam(CmResponsesEnum,iomodel->cm_responses, iomodel->nsteps,iomodel->num_cm_responses));56 parameters->AddObject(new DoubleVecParam(CmJumpEnum,iomodel->cm_jump, iomodel->nsteps));57 parameters->AddObject(new DoubleVecParam(MaxiterEnum,iomodel->maxiter, iomodel->nsteps));51 parameters->AddObject(new DoubleMatParam(OptscalEnum,iomodel->optscal,nsteps,num_control_type)); 52 parameters->AddObject(new DoubleMatParam(CmResponsesEnum,iomodel->cm_responses,nsteps,num_cm_responses)); 53 parameters->AddObject(new DoubleVecParam(CmJumpEnum,iomodel->cm_jump,nsteps)); 54 parameters->AddObject(new DoubleVecParam(MaxiterEnum,iomodel->maxiter,nsteps)); 58 55 59 56 xfree((void**)&iomodel->cm_responses); -
issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r9343 r9356 21 21 Element *element = NULL; 22 22 Material *material = NULL; 23 int numberofelements; 24 int num_control_type; 25 bool control_analysis; 26 27 28 /*Fetch parameters: */ 29 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 30 iomodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum); 31 iomodel->parameters->FindParam(&num_control_type,NumControlTypeEnum); 23 32 24 33 /*Now, return if no control*/ 25 if (! iomodel->control_analysis) return;34 if (!control_analysis) return; 26 35 27 36 /*Fetch data needed: */ 28 37 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 29 30 38 iomodel->FetchDataToInput(elements,VxObsEnum); 31 39 iomodel->FetchDataToInput(elements,VyObsEnum); … … 36 44 iomodel->FetchData(&iomodel->cm_min,NULL,NULL,CmMinEnum); 37 45 iomodel->FetchData(&iomodel->cm_max,NULL,NULL,CmMaxEnum); 38 for(i=0;i< iomodel->num_control_type;i++){46 for(i=0;i<num_control_type;i++){ 39 47 switch((int)iomodel->control_type[i]){ 40 48 case DhdtEnum: … … 60 68 /*Update elements and materials: */ 61 69 counter=0; 62 for (i=0;i< iomodel->numberofelements;i++){70 for (i=0;i<numberofelements;i++){ 63 71 if(iomodel->my_elements[i]){ 64 72 element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r9340 r9356 17 17 /*Intermediary*/ 18 18 int i,j,k,n; 19 int dim; 20 int numberofelements; 21 int numberofvertices; 19 22 20 23 /*DataSets: */ … … 22 25 Vertices* vertices = NULL; 23 26 Materials* materials = NULL; 27 28 /*Fetch parameters: */ 29 iomodel->parameters->FindParam(&dim,DimEnum); 30 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 31 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 24 32 25 33 /*Did we already create the elements? : */ … … 46 54 47 55 /*Create elements and materials: */ 48 for (i=0;i< iomodel->numberofelements;i++){56 for (i=0;i<numberofelements;i++){ 49 57 50 58 if(iomodel->my_elements[i]){ 51 59 52 60 /*Create and add tria element to elements dataset: */ 53 if( iomodel->dim==2)61 if(dim==2) 54 62 elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels)); 55 63 else … … 73 81 74 82 /*Add new constrant material property tgo materials, at the end: */ 75 materials->AddObject(new Matpar( iomodel->numberofelements+1,iomodel));//put it at the end of the materials83 materials->AddObject(new Matpar(numberofelements+1,iomodel));//put it at the end of the materials 76 84 77 85 /*Create vertices: */ … … 82 90 iomodel->FetchData(&iomodel->thickness,NULL,NULL,ThicknessEnum); 83 91 84 for (i=0;i< iomodel->numberofvertices;i++){92 for (i=0;i<numberofvertices;i++){ 85 93 86 94 /*vertices and nodes (same number, as we are running continuous galerkin formulation: */ -
issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
r9320 r9356 20 20 int vertexid; 21 21 int elementswidth; 22 int dim; 23 int numberofelements; 24 int numberofvertices; 22 25 23 26 /*output*/ 24 27 int* connectivity=NULL; 25 28 29 /*Fetch parameters: */ 30 iomodel->parameters->FindParam(&dim,DimEnum); 31 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 32 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 33 26 34 /*Some checks if debugging*/ 27 _assert_( iomodel->numberofvertices);28 _assert_( iomodel->numberofelements);35 _assert_(numberofvertices); 36 _assert_(numberofelements); 29 37 _assert_(iomodel->elements); 30 38 31 39 /*Allocate ouput*/ 32 connectivity=(int*)xcalloc( iomodel->numberofvertices,sizeof(int));40 connectivity=(int*)xcalloc(numberofvertices,sizeof(int)); 33 41 34 42 /*Get element width (3 or 6)*/ 35 if ( iomodel->dim==2){43 if (dim==2){ 36 44 elementswidth=3; 37 45 } … … 41 49 42 50 /*Create connectivity table*/ 43 for (i=0;i< iomodel->numberofelements;i++){51 for (i=0;i<numberofelements;i++){ 44 52 for (j=0;j<elementswidth;j++){ 45 53 vertexid=(int)iomodel->elements[elementswidth*i+j]; 46 _assert_(vertexid>0 && vertexid-1< iomodel->numberofvertices);54 _assert_(vertexid>0 && vertexid-1<numberofvertices); 47 55 connectivity[vertexid-1]+=1; 48 56 } -
issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
r9340 r9356 24 24 25 25 /*Initialize dataset: */ 26 parameters = new Parameters(ParametersEnum);26 parameters = (Parameters*)iomodel->parameters->Copy(); 27 27 28 /*some parameters that did not come with the iomodel: */ 28 29 parameters->AddObject(new IntParam(SolutionTypeEnum,solution_type)); 29 30 parameters->AddObject(new IntParam(AnalysisTypeEnum,analysis_type)); 30 31 parameters->AddObject(new IntParam(AnalysisCounterEnum,analysis_counter)); 31 32 32 parameters->AddObject(new IntParam(DimEnum,iomodel->dim));33 parameters->AddObject(new BoolParam(IshutterEnum,iomodel->ishutter));34 parameters->AddObject(new BoolParam(IsmacayealpattynEnum,iomodel->ismacayealpattyn));35 parameters->AddObject(new BoolParam(IsstokesEnum,iomodel->isstokes));36 parameters->AddObject(new IntParam(OutputFrequencyEnum,iomodel->output_frequency));37 parameters->AddObject(new DoubleParam(EpsResEnum,iomodel->eps_res));38 parameters->AddObject(new DoubleParam(EpsRelEnum,iomodel->eps_rel));39 parameters->AddObject(new DoubleParam(EpsAbsEnum,iomodel->eps_abs));40 parameters->AddObject(new IntParam(MaxNonlinearIterationsEnum,(IssmInt)iomodel->max_nonlinear_iterations));41 parameters->AddObject(new IntParam(MaxSteadystateIterationsEnum,(IssmInt)iomodel->max_steadystate_iterations));42 parameters->AddObject(new DoubleParam(EpsvelEnum,iomodel->epsvel));43 parameters->AddObject(new DoubleParam(YtsEnum,iomodel->yts));44 parameters->AddObject(new DoubleParam(DtEnum,iomodel->dt*iomodel->yts)); //Ndt is in yeats in iomodel45 parameters->AddObject(new DoubleParam(NdtEnum,iomodel->ndt*iomodel->yts));//Ndt is in yeats in iomodel46 parameters->AddObject(new BoolParam(TimeAdaptEnum,iomodel->time_adapt));47 parameters->AddObject(new DoubleParam(CflCoefficientEnum,iomodel->cfl_coefficient));48 parameters->AddObject(new IntParam(HydrostaticAdjustmentEnum,iomodel->hydrostatic_adjustment));49 parameters->AddObject(new DoubleParam(PenaltyOffsetEnum,iomodel->penalty_offset));50 parameters->AddObject(new DoubleParam(SparsityEnum,iomodel->sparsity));51 parameters->AddObject(new BoolParam(LowmemEnum,iomodel->lowmem));52 parameters->AddObject(new IntParam(ConnectivityEnum,iomodel->connectivity));53 parameters->AddObject(new DoubleParam(BetaEnum,iomodel->beta));54 parameters->AddObject(new DoubleParam(MeltingpointEnum,iomodel->meltingpoint));55 parameters->AddObject(new DoubleParam(ReferencetemperatureEnum,iomodel->referencetemperature));56 parameters->AddObject(new DoubleParam(LatentheatEnum,iomodel->latentheat));57 parameters->AddObject(new DoubleParam(HeatcapacityEnum,iomodel->heatcapacity));58 parameters->AddObject(new IntParam(ArtDiffEnum,iomodel->artdiff));59 parameters->AddObject(new IntParam(BasalMeltingRateCorrectionApplyEnum,iomodel->basal_melting_rate_correction_apply));60 parameters->AddObject(new DoubleParam(GroundingLineMeltingRateEnum,iomodel->gl_melting_rate));61 parameters->AddObject(new DoubleParam(PenaltyMeltingEnum,iomodel->penalty_melting));62 parameters->AddObject(new IntParam(MinThermalConstraintsEnum,iomodel->min_thermal_constraints));63 parameters->AddObject(new IntParam(MinMechanicalConstraintsEnum,iomodel->min_mechanical_constraints));64 parameters->AddObject(new IntParam(StabilizeConstraintsEnum,iomodel->stabilize_constraints));65 parameters->AddObject(new DoubleParam(StokesreconditioningEnum,iomodel->stokesreconditioning));66 parameters->AddObject(new IntParam(ShelfDampeningEnum,iomodel->shelf_dampening));67 parameters->AddObject(new DoubleParam(ViscosityOvershootEnum,iomodel->viscosity_overshoot));68 parameters->AddObject(new BoolParam(WaitonlockEnum,iomodel->waitonlock));69 parameters->AddObject(new IntParam(NumberOfElementsEnum,iomodel->numberofelements));70 parameters->AddObject(new BoolParam(IoGatherEnum,iomodel->io_gather));71 parameters->AddObject(new IntParam(GroundingLineMigrationEnum,iomodel->gl_migration));72 parameters->AddObject(new IntParam(RheologyLawEnum,iomodel->rheology_law));73 parameters->AddObject(new BoolParam(IsdiagnosticEnum,iomodel->isdiagnostic));74 parameters->AddObject(new BoolParam(IsprognosticEnum,iomodel->isprognostic));75 parameters->AddObject(new BoolParam(IsthermalEnum,iomodel->isthermal));76 33 parameters->AddObject(new DoubleParam(TimeEnum,0.0)); //start at time 0 by default for all solutions. 77 78 /*Deal with more complex parameters*/79 iomodel->FetchData(&iomodel->riftinfo,&iomodel->numrifts,NULL,RiftinfoEnum);80 parameters->AddObject(new IntParam(NumRiftsEnum,iomodel->numrifts));81 xfree((void**)&iomodel->riftinfo);82 83 34 84 35 /*Requested output?*/ … … 92 43 CreateParametersQmu(¶meters,iomodel,solution_type,analysis_type); 93 44 45 /*Go through all parameters, and convert units to SI: */ 46 parameters->UnitConversion(ExtToIuEnum); 47 94 48 /*Assign output pointer: */ 95 49 *pparameters=parameters; -
issm/trunk/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
r9320 r9356 20 20 int vertexid; 21 21 int elementswidth; 22 int dim; 23 int numberofelements; 24 int numberofvertices; 22 25 23 26 /*output*/ 24 27 int* connectivity=NULL; 25 28 29 /*Fetch parameters: */ 30 iomodel->parameters->FindParam(&dim,DimEnum); 31 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 32 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 33 26 34 /*Some checks if debugging*/ 27 _assert_( iomodel->numberofvertices);28 _assert_( iomodel->numberofelements);35 _assert_(numberofvertices); 36 _assert_(numberofelements); 29 37 _assert_(iomodel->my_elements); 30 38 _assert_(iomodel->elements); 31 39 32 40 /*Allocate ouput*/ 33 connectivity=(int*)xcalloc( iomodel->numberofvertices,sizeof(int));41 connectivity=(int*)xcalloc(numberofvertices,sizeof(int)); 34 42 35 43 /*Get element width (3 or 6)*/ 36 if ( iomodel->dim==2){44 if (dim==2){ 37 45 elementswidth=3; 38 46 } … … 42 50 43 51 /*Create connectivity table*/ 44 for (i=0;i< iomodel->numberofelements;i++){52 for (i=0;i<numberofelements;i++){ 45 53 /*!! in parallel we do not want the vertex to be connected to an element that is not in its partition!!*/ 46 54 if(iomodel->my_elements[i]){ 47 55 for (j=0;j<elementswidth;j++){ 48 56 vertexid=(int)iomodel->elements[elementswidth*i+j]; 49 _assert_(vertexid>0 && vertexid-1< iomodel->numberofvertices);57 _assert_(vertexid>0 && vertexid-1<numberofvertices); 50 58 connectivity[vertexid-1]=i+1; 51 59 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
r9340 r9356 16 16 int i,j; 17 17 int count; 18 double yts; 19 double g; 20 double rho_ice; 21 double stokesreconditioning; 22 bool isstokes,ismacayealpattyn; 18 23 19 24 /*Output*/ … … 21 26 SpcStatic* spcstatic = NULL; 22 27 int node1,node2; 28 int dim; 29 int numberofvertices; 30 31 /*Fetch parameters: */ 32 iomodel->parameters->FindParam(&dim,DimEnum); 33 iomodel->parameters->FindParam(&yts,YtsEnum); 34 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 35 iomodel->parameters->FindParam(&g,GEnum); 36 iomodel->parameters->FindParam(&rho_ice,RhoIceEnum); 37 iomodel->parameters->FindParam(&stokesreconditioning,StokesreconditioningEnum); 38 iomodel->parameters->FindParam(&isstokes,IsstokesEnum); 39 iomodel->parameters->FindParam(&ismacayealpattyn,IsmacayealpattynEnum); 23 40 24 41 /*Recover pointer: */ … … 29 46 30 47 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 31 if (!i omodel->ismacayealpattyn & !iomodel->isstokes)goto cleanup_and_return;48 if (!ismacayealpattyn & !isstokes)goto cleanup_and_return; 32 49 33 50 /*Constraints: fetch data: */ … … 37 54 iomodel->FetchData(&iomodel->nodeonhutter,NULL,NULL,NodeOnHutterEnum); 38 55 iomodel->FetchData(&iomodel->nodeonmacayeal,NULL,NULL,NodeOnMacayealEnum); 39 if( iomodel->dim==3)iomodel->FetchData(&iomodel->nodeonpattyn,NULL,NULL,NodeOnPattynEnum);40 if( iomodel->dim==3)iomodel->FetchData(&iomodel->nodeonstokes,NULL,NULL,NodeOnStokesEnum);56 if(dim==3)iomodel->FetchData(&iomodel->nodeonpattyn,NULL,NULL,NodeOnPattynEnum); 57 if(dim==3)iomodel->FetchData(&iomodel->nodeonstokes,NULL,NULL,NodeOnStokesEnum); 41 58 iomodel->FetchData(&iomodel->vertices_type,NULL,NULL,VerticesTypeEnum); 42 59 iomodel->FetchData(&iomodel->surface,NULL,NULL,SurfaceEnum); … … 47 64 48 65 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ 49 for (i=0;i< iomodel->numberofvertices;i++){66 for (i=0;i<numberofvertices;i++){ 50 67 if(iomodel->my_vertices[i]){ 51 68 … … 59 76 count++; 60 77 if (!isnan(iomodel->spcvx[i])){ 61 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.62 count++; 63 } 64 if (!isnan(iomodel->spcvy[i])){ 65 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.78 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 79 count++; 80 } 81 if (!isnan(iomodel->spcvy[i])){ 82 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 66 83 count++; 67 84 } … … 74 91 count++; 75 92 if (!isnan(iomodel->spcvx[i])){ 76 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.77 count++; 78 } 79 if (!isnan(iomodel->spcvy[i])){ 80 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.93 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 94 count++; 95 } 96 if (!isnan(iomodel->spcvy[i])){ 97 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 81 98 count++; 82 99 } … … 96 113 count++; 97 114 if (!isnan(iomodel->spcvx[i])){ 98 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.99 count++; 100 } 101 if (!isnan(iomodel->spcvy[i])){ 102 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.115 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 116 count++; 117 } 118 if (!isnan(iomodel->spcvy[i])){ 119 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 103 120 count++; 104 121 } … … 111 128 count++; 112 129 if (!isnan(iomodel->spcvx[i])){ 113 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.114 count++; 115 } 116 if (!isnan(iomodel->spcvy[i])){ 117 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.130 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 131 count++; 132 } 133 if (!isnan(iomodel->spcvy[i])){ 134 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 118 135 count++; 119 136 } 120 137 if (!isnan(iomodel->spcvz[i])){ 121 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,iomodel->spcvz[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.138 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,iomodel->spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 122 139 count++; 123 140 } … … 136 153 count++; 137 154 if (!isnan(iomodel->spcvx[i])){ 138 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.139 count++; 140 } 141 if (!isnan(iomodel->spcvy[i])){ 142 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.155 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 156 count++; 157 } 158 if (!isnan(iomodel->spcvy[i])){ 159 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 143 160 count++; 144 161 } … … 151 168 count++; 152 169 if (!isnan(iomodel->spcvx[i])){ 153 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.154 count++; 155 } 156 if (!isnan(iomodel->spcvy[i])){ 157 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.170 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 171 count++; 172 } 173 if (!isnan(iomodel->spcvy[i])){ 174 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 158 175 count++; 159 176 } 160 177 if (!isnan(iomodel->spcvz[i])){ 161 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,iomodel->spcvz[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.178 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,iomodel->spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 162 179 count++; 163 180 } … … 168 185 else{ 169 186 if (!isnan(iomodel->spcvx[i])){ 170 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.187 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 171 188 count++; 172 189 } … … 177 194 178 195 if (!isnan(iomodel->spcvy[i])){ 179 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy.196 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy. 180 197 count++; 181 198 } … … 186 203 187 204 if (!isnan(iomodel->spcvz[i]) && ((int)iomodel->vertices_type[i]==StokesApproximationEnum || ((int)iomodel->vertices_type[i]==NoneApproximationEnum))){ 188 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvz[i]/ iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy205 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 189 206 count++; 190 207 } 191 208 if ((int)iomodel->vertices_type[i]==NoneApproximationEnum){ 192 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4, iomodel->g*iomodel->rho_ice*(iomodel->surface[i]-iomodel->z[i])/iomodel->stokesreconditioning,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy209 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,g*rho_ice*(iomodel->surface[i]-iomodel->z[i])/stokesreconditioning,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 193 210 count++; 194 211 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r9340 r9356 25 25 int count=0; 26 26 int penpair_ids[2]; 27 int dim; 28 int numberofvertices; 29 bool ismacayealpattyn,isstokes; 30 int numpenalties,numberofpressureloads,numrifts; 31 32 /*Fetch parameters: */ 33 iomodel->parameters->FindParam(&dim,DimEnum); 34 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 35 iomodel->parameters->FindParam(&isstokes,IsstokesEnum); 36 iomodel->parameters->FindParam(&ismacayealpattyn,IsmacayealpattynEnum); 27 37 28 38 /*Recover pointer: */ … … 33 43 34 44 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 35 if (!i omodel->ismacayealpattyn & !iomodel->isstokes)goto cleanup_and_return;45 if (!ismacayealpattyn & !isstokes)goto cleanup_and_return; 36 46 37 47 /*Create pressure loads as boundary conditions. Pay attention to the partitioning if we are running in parallel (the nodes 38 48 * referenced by a certain load must belong to the cluster node): */ 39 iomodel->FetchData(&iomodel->pressureload,& iomodel->numberofpressureloads,NULL,PressureloadEnum);49 iomodel->FetchData(&iomodel->pressureload,&numberofpressureloads,NULL,PressureloadEnum); 40 50 iomodel->FetchData(&iomodel->elements_type,NULL,NULL,ElementsTypeEnum); 41 51 iomodel->FetchData(&iomodel->thickness,NULL,NULL,ThicknessEnum); … … 46 56 47 57 /*First load data:*/ 48 for (i=0;i< iomodel->numberofpressureloads;i++){58 for (i=0;i<numberofpressureloads;i++){ 49 59 50 60 /*Retrieve element to which this icefront belongs: */ 51 if ( iomodel->dim==2) segment_width=4;61 if (dim==2) segment_width=4; 52 62 else segment_width=6; 53 63 element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill) … … 60 70 61 71 /*Create and add load: */ 62 if ((int)*(iomodel->elements_type+element)==(MacAyealApproximationEnum) && iomodel->dim==2){72 if ((int)*(iomodel->elements_type+element)==(MacAyealApproximationEnum) && dim==2){ 63 73 loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,MacAyeal2dIceFrontEnum,DiagnosticHorizAnalysisEnum)); 64 74 count++; 65 75 } 66 else if ((int)*(iomodel->elements_type+element)==(MacAyealApproximationEnum) && iomodel->dim==3){76 else if ((int)*(iomodel->elements_type+element)==(MacAyealApproximationEnum) && dim==3){ 67 77 loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,MacAyeal3dIceFrontEnum,DiagnosticHorizAnalysisEnum)); 68 78 count++; … … 113 123 CreateSingleNodeToElementConnectivity(iomodel); 114 124 115 for (i=0;i< iomodel->numberofvertices;i++){125 for (i=0;i<numberofvertices;i++){ 116 126 117 127 if(iomodel->my_vertices[i]==1 && iomodel->singlenodetoelementconnectivity[i]!=0){ … … 137 147 138 148 /*Create Penpair for penalties: */ 139 iomodel->FetchData(&iomodel->penalties,& iomodel->numpenalties,NULL,PenaltiesEnum);149 iomodel->FetchData(&iomodel->penalties,&numpenalties,NULL,PenaltiesEnum); 140 150 141 for(i=0;i< iomodel->numpenalties;i++){151 for(i=0;i<numpenalties;i++){ 142 152 143 153 if(iomodel->my_vertices[(int)iomodel->penalties[2*i+0]-1]){ … … 160 170 161 171 /*Create Riffront loads for rifts: */ 162 iomodel->FetchData(&iomodel->riftinfo,& iomodel->numrifts,NULL,RiftinfoEnum);172 iomodel->FetchData(&iomodel->riftinfo,&numrifts,NULL,RiftinfoEnum); 163 173 iomodel->FetchData(&iomodel->thickness,NULL,NULL,ThicknessEnum); 164 174 iomodel->FetchData(&iomodel->bed,NULL,NULL,BedEnum); … … 167 177 168 178 169 for(i=0;i< iomodel->numrifts;i++){179 for(i=0;i<numrifts;i++){ 170 180 171 181 if(iomodel->my_elements[(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)-1]){ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp
r9340 r9356 17 17 /*Intermediary*/ 18 18 int i; 19 bool continuous_galerkin=true; 19 bool continuous_galerkin=true; 20 int numberofvertices; 21 bool isstokes,ismacayealpattyn; 20 22 21 23 /*DataSets: */ 22 24 Nodes* nodes = NULL; 25 26 /*Fetch parameters: */ 27 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 28 iomodel->parameters->FindParam(&isstokes,IsstokesEnum); 29 iomodel->parameters->FindParam(&ismacayealpattyn,IsmacayealpattynEnum); 23 30 24 31 /*Recover pointer: */ … … 29 36 30 37 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 31 if (!i omodel->ismacayealpattyn & !iomodel->isstokes)goto cleanup_and_return;38 if (!ismacayealpattyn & !isstokes)goto cleanup_and_return; 32 39 33 40 /*Continuous Galerkin partition of nodes: */ … … 46 53 iomodel->FetchData(&iomodel->diagnostic_ref,NULL,NULL,DiagnosticRefEnum); 47 54 48 for (i=0;i< iomodel->numberofvertices;i++){55 for (i=0;i<numberofvertices;i++){ 49 56 50 57 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
r9343 r9356 16 16 void UpdateElementsDiagnosticHoriz(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 19 if (!iomodel->ismacayealpattyn & !iomodel->isstokes) return; 20 18 int dim; 19 int numberofelements; 20 bool ismacayealpattyn; 21 bool isstokes; 22 bool control_analysis; 23 bool qmu_analysis; 24 21 25 /*Fetch data needed: */ 22 26 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 23 27 iomodel->FetchData(&iomodel->elements_type,NULL,NULL,ElementsTypeEnum); 24 28 29 iomodel->parameters->FindParam(&isstokes,IsstokesEnum); 30 iomodel->parameters->FindParam(&ismacayealpattyn,IsmacayealpattynEnum); 31 iomodel->parameters->FindParam(&dim,DimEnum); 32 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 33 iomodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum); 34 iomodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum); 35 36 37 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 38 if (!ismacayealpattyn & !isstokes) return; 39 25 40 /*Update elements: */ 26 41 int counter=0; 27 for(int i=0;i< iomodel->numberofelements;i++){42 for(int i=0;i<numberofelements;i++){ 28 43 if(iomodel->my_elements[i]){ 29 44 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 50 65 iomodel->FetchDataToInput(elements,BathymetryEnum); 51 66 52 if ( iomodel->dim==3){67 if (dim==3){ 53 68 iomodel->FetchDataToInput(elements,ElementOnBedEnum); 54 69 iomodel->FetchDataToInput(elements,ElementOnSurfaceEnum); … … 61 76 } 62 77 63 if( iomodel->control_analysis){78 if(control_analysis){ 64 79 iomodel->FetchDataToInput(elements,VxObsEnum); 65 80 iomodel->FetchDataToInput(elements,VyObsEnum); … … 70 85 elements->InputDuplicate(VxEnum,VxPicardEnum); 71 86 elements->InputDuplicate(VxEnum,VxObsEnum); 72 if( iomodel->qmu_analysis)elements->InputDuplicate(VxEnum,QmuVxEnum);87 if(qmu_analysis)elements->InputDuplicate(VxEnum,QmuVxEnum); 73 88 74 89 elements->InputDuplicate(VyEnum,VyPicardEnum); 75 90 elements->InputDuplicate(VyEnum,VyObsEnum); 76 if( iomodel->qmu_analysis)elements->InputDuplicate(VyEnum,QmuVyEnum);91 if(qmu_analysis)elements->InputDuplicate(VyEnum,QmuVyEnum); 77 92 78 if( iomodel->dim==3){93 if(dim==3){ 79 94 elements->InputDuplicate(VzEnum,VzPicardEnum); 80 95 elements->InputDuplicate(VzEnum,VzObsEnum); 81 if( iomodel->qmu_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);96 if(qmu_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum); 82 97 } 83 98 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp
r9340 r9356 16 16 int i; 17 17 int count; 18 double yts; 19 int numberofvertices; 20 bool ishutter; 18 21 19 22 /*Output*/ … … 24 27 constraints=*pconstraints; 25 28 29 /*Fetch parameters: */ 30 iomodel->parameters->FindParam(&yts,YtsEnum); 31 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 32 iomodel->parameters->FindParam(&ishutter,IshutterEnum); 33 26 34 /*Create constraints if they do not exist yet*/ 27 35 if(!constraints) constraints = new Constraints(ConstraintsEnum); 28 36 29 37 /*Now, is the flag ishutter on? otherwise, do nothing: */ 30 if (!i omodel->ishutter) goto cleanup_and_return;38 if (!ishutter) goto cleanup_and_return; 31 39 32 40 /*Fetch data: */ … … 39 47 40 48 /*vx and vy are spc'd if we are not on nodeonhutter: */ 41 for (i=0;i< iomodel->numberofvertices;i++){49 for (i=0;i<numberofvertices;i++){ 42 50 /*keep only this partition's nodes:*/ 43 51 if((iomodel->my_vertices[i])){ … … 52 60 else{ 53 61 if (!isnan(iomodel->spcvx[i])){ 54 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/ iomodel->yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.62 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 55 63 count++; 56 64 } 57 65 58 66 if (!isnan(iomodel->spcvy[i])){ 59 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/ iomodel->yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy67 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 60 68 count++; 61 69 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 21 bool ishutter; 20 22 21 23 /*DataSets: */ 22 24 Nodes* nodes = NULL; 25 26 /*Fetch parameters: */ 27 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 28 iomodel->parameters->FindParam(&ishutter,IshutterEnum); 23 29 24 30 /*Recover pointer: */ … … 29 35 30 36 /*Now, is the flag ishutter on? otherwise, do nothing: */ 31 if (!i omodel->ishutter)goto cleanup_and_return;37 if (!ishutter)goto cleanup_and_return; 32 38 33 39 /*Continuous Galerkin partition of nodes: */ … … 46 52 CreateNumberNodeToElementConnectivity(iomodel); 47 53 48 for (i=0;i< iomodel->numberofvertices;i++){54 for (i=0;i<numberofvertices;i++){ 49 55 50 56 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp
r9343 r9356 16 16 void UpdateElementsDiagnosticHutter(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 /*Now, is the flag hutter on? otherwise, do nothing: */19 if (!iomodel->ishutter)return;18 int numberofelements; 19 bool ishutter; 20 20 21 21 22 /*Fetch data needed: */ 22 23 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 23 24 iomodel->FetchData(&iomodel->elements_type,NULL,NULL,ElementsTypeEnum); 25 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 26 iomodel->parameters->FindParam(&ishutter,IshutterEnum); 27 28 /*Now, is the flag hutter on? otherwise, do nothing: */ 29 if (!ishutter)return; 24 30 25 31 /*Update elements: */ 26 32 int counter=0; 27 for(int i=0;i< iomodel->numberofelements;i++){33 for(int i=0;i<numberofelements;i++){ 28 34 if(iomodel->my_elements[i]){ 29 35 Element* element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r9340 r9356 15 15 /*Intermediary*/ 16 16 int i; 17 int dim; 17 18 int count; 19 double yts; 20 int numberofvertices; 18 21 19 22 /*Output*/ 20 23 Constraints* constraints = NULL; 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&dim,DimEnum); 27 iomodel->parameters->FindParam(&yts,YtsEnum); 21 28 22 29 /*Recover pointer: */ … … 27 34 28 35 /*return if 2d mesh*/ 29 if ( iomodel->dim==2) goto cleanup_and_return;36 if (dim==2) goto cleanup_and_return; 30 37 31 38 /*Fetch data: */ 32 39 iomodel->FetchData(&iomodel->spcvz,NULL,NULL,SpcvzEnum); 33 40 iomodel->FetchData(&iomodel->nodeonstokes,NULL,NULL,NodeOnStokesEnum); 41 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 34 42 35 43 /*Initialize counter*/ … … 37 45 38 46 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ 39 for (i=0;i< iomodel->numberofvertices;i++){47 for (i=0;i<numberofvertices;i++){ 40 48 41 49 /*keep only this partition's nodes:*/ … … 48 56 else if (!isnan(iomodel->spcvz[i])){ 49 57 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, 50 iomodel->spcvz[i]/ iomodel->yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.58 iomodel->spcvz[i]/yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 51 59 count++; 52 60 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int dim; 21 int numberofvertices; 20 22 21 23 /*DataSets: */ 22 24 Nodes* nodes = NULL; 25 26 /*Fetch parameters: */ 27 iomodel->parameters->FindParam(&dim,DimEnum); 28 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 23 29 24 30 /*Recover pointer: */ … … 29 35 30 36 /*Now, is the flag macayaealpattyn on? otherwise, do nothing: */ 31 if ( iomodel->dim==2)goto cleanup_and_return;37 if (dim==2)goto cleanup_and_return; 32 38 33 39 /*Continuous Galerkin partition of nodes: */ … … 42 48 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 43 49 44 for (i=0;i< iomodel->numberofvertices;i++){50 for (i=0;i<numberofvertices;i++){ 45 51 46 52 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp
r9343 r9356 16 16 void UpdateElementsDiagnosticVert(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 21 /*Fetch parameters: */ 22 iomodel->parameters->FindParam(&dim,DimEnum); 23 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 24 18 25 /*Now, is the model 3d? otherwise, do nothing: */ 19 if ( iomodel->dim==2)return;26 if (dim==2)return; 20 27 21 28 /*Fetch data needed: */ … … 24 31 /*Update elements: */ 25 32 int counter=0; 26 for(int i=0;i< iomodel->numberofelements;i++){33 for(int i=0;i<numberofelements;i++){ 27 34 if(iomodel->my_elements[i]){ 28 35 Element* element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r9340 r9356 24 24 extern int my_rank; 25 25 extern int num_procs; 26 int numberofelements; 27 int numberofvertices; 28 int numberofelements2d; 29 int numberofvertices2d; 30 int numlayers; 31 int numrifts; 32 int numpenalties; 26 33 27 34 /*output: */ … … 34 41 int elements_width; //number of columns in elements (2d->3, 3d->6) 35 42 int el1,el2; 43 int dim; 44 45 /*Fetch parameters: */ 46 iomodel->parameters->FindParam(&dim,DimEnum); 47 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 48 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 49 iomodel->parameters->FindParam(&numberofelements2d,NumberOfElements2DEnum); 50 iomodel->parameters->FindParam(&numberofvertices2d,NumberOfNodes2DEnum); 51 iomodel->parameters->FindParam(&numlayers,NumlayersEnum); 52 iomodel->parameters->FindParam(&numrifts,NumRiftsEnum); 36 53 37 54 /*First, check that partitioning has not yet been carryed out. Just check whether my_elements pointers is not already assigned a value: */ … … 39 56 40 57 /*Number of vertices per elements, needed to correctly retrieve data: */ 41 if( iomodel->dim==2) elements_width=3; //tria elements58 if(dim==2) elements_width=3; //tria elements 42 59 else elements_width=6; //penta elements 43 60 44 61 #ifdef _PARALLEL_ 45 62 /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/ 46 if( iomodel->dim==2){63 if(dim==2){ 47 64 /*load elements: */ 48 65 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); … … 53 70 } 54 71 55 MeshPartitionx(&epart, &npart, iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofvertices2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->dim,num_procs);72 MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,iomodel->elements, numberofelements2d,numberofvertices2d,iomodel->elements2d,numlayers,elements_width, dim,num_procs); 56 73 57 74 /*Free elements and elements2d: */ … … 61 78 #else 62 79 /*In serial mode, epart is full of 0: all elements belong to cpu 0: */ 63 epart=(int*)xcalloc( iomodel->numberofelements,sizeof(int));80 epart=(int*)xcalloc(numberofelements,sizeof(int)); 64 81 #endif 65 82 66 83 /*Deal with rifts, they have to be included into one partition only, not several: */ 67 iomodel->FetchData(&iomodel->riftinfo,& iomodel->numrifts,NULL,RiftinfoEnum);84 iomodel->FetchData(&iomodel->riftinfo,&numrifts,NULL,RiftinfoEnum); 68 85 69 for(i=0;i< iomodel->numrifts;i++){86 for(i=0;i<numrifts;i++){ 70 87 el1=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing 71 88 el2=(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing … … 77 94 78 95 /*Used later on: */ 79 my_vertices=(int*)xcalloc( iomodel->numberofvertices,sizeof(int));80 my_elements=(bool*)xcalloc( iomodel->numberofelements,sizeof(bool));96 my_vertices=(int*)xcalloc(numberofvertices,sizeof(int)); 97 my_elements=(bool*)xcalloc(numberofelements,sizeof(bool)); 81 98 82 99 /*Start figuring out, out of the partition, which elements belong to this cpu: */ 83 100 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 84 for (i=0;i< iomodel->numberofelements;i++){101 for (i=0;i<numberofelements;i++){ 85 102 86 103 /*!All elements have been partitioned above, only deal with elements for this cpu: */ … … 110 127 * penpair has 2 nodes that are poointing toward 2 vertices. 111 128 * The 2 vertices must be in the same cpu as the penpair*/ 112 iomodel->FetchData(&iomodel->penalties,& iomodel->numpenalties,NULL,PenaltiesEnum);113 for(i=0;i< iomodel->numpenalties;i++){129 iomodel->FetchData(&iomodel->penalties,&numpenalties,NULL,PenaltiesEnum); 130 for(i=0;i<numpenalties;i++){ 114 131 if(my_vertices[(int)iomodel->penalties[2*i+0]-1] && !my_vertices[(int)iomodel->penalties[2*i+1]-1]){ 115 132 my_vertices[(int)iomodel->penalties[2*i+1]-1]=2; //to know that these elements are not on the partition -
issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp
r9340 r9356 16 16 int i; 17 17 int count; 18 int dim; 19 int numberofvertices; 20 double heatcapacity; 21 double referencetemperature; 18 22 19 23 /*Output*/ 20 24 Constraints* constraints = NULL; 21 25 SpcStatic* spcstatic = NULL; 26 27 /*Fetch parameters: */ 28 iomodel->parameters->FindParam(&dim,DimEnum); 29 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 30 iomodel->parameters->FindParam(&heatcapacity,HeatcapacityEnum); 31 iomodel->parameters->FindParam(&referencetemperature,ReferencetemperatureEnum); 22 32 23 33 /*Recover pointer: */ … … 28 38 29 39 /*return if 2d mesh*/ 30 if ( iomodel->dim==2) goto cleanup_and_return;40 if (dim==2) goto cleanup_and_return; 31 41 32 42 /*Fetch data: */ … … 37 47 38 48 /*Create constraints from x,y,z: */ 39 for (i=0;i< iomodel->numberofvertices;i++){49 for (i=0;i<numberofvertices;i++){ 40 50 /*keep only this partition's nodes:*/ 41 51 if((iomodel->my_vertices[i])){ … … 43 53 if ((int)iomodel->spctemperature[2*i]){ 44 54 45 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, iomodel->heatcapacity*(iomodel->spctemperature[2*i+1]-iomodel->referencetemperature),EnthalpyAnalysisEnum));55 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(iomodel->spctemperature[2*i+1]-referencetemperature),EnthalpyAnalysisEnum)); 46 56 count++; 47 57 -
issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateNodesEnthalpy.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 20 21 21 22 /*DataSets: */ 22 23 Nodes* nodes = NULL; 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 23 27 24 28 /*Recover pointer: */ … … 39 43 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 40 44 41 for (i=0;i< iomodel->numberofvertices;i++){45 for (i=0;i<numberofvertices;i++){ 42 46 43 47 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
r9343 r9356 16 16 void UpdateElementsEnthalpy(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 21 /*Fetch parameters: */ 22 iomodel->parameters->FindParam(&dim,DimEnum); 23 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 24 18 25 /*Now, is the model 3d? otherwise, do nothing: */ 19 if ( iomodel->dim==2)return;26 if (dim==2)return; 20 27 21 28 /*Fetch data needed: */ … … 24 31 /*Update elements: */ 25 32 int counter=0; 26 for(int i=0;i< iomodel->numberofelements;i++){33 for(int i=0;i<numberofelements;i++){ 27 34 if(iomodel->my_elements[i]){ 28 35 Element* element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 20 21 21 22 /*DataSets: */ 22 23 Nodes* nodes = NULL; 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 23 27 24 28 /*Recover pointer: */ … … 39 43 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 40 44 41 for (i=0;i< iomodel->numberofvertices;i++){45 for (i=0;i<numberofvertices;i++){ 42 46 43 47 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp
r9343 r9356 16 16 void UpdateElementsHydrology(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int numberofelements; 19 18 20 /*Fetch data needed: */ 19 21 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 22 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 20 23 21 24 /*Update elements: */ 22 25 int counter=0; 23 for(int i=0;i< iomodel->numberofelements;i++){26 for(int i=0;i<numberofelements;i++){ 24 27 if(iomodel->my_elements[i]){ 25 28 Element* element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp
r9340 r9356 15 15 /*Intermediary*/ 16 16 int i; 17 int dim; 18 int numberofvertices; 17 19 18 20 /*DataSet*/ 19 21 Loads* loads = NULL; 20 22 23 /*Fetch parameters: */ 24 iomodel->parameters->FindParam(&dim,DimEnum); 25 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 26 21 27 /*if 2d: Error*/ 22 if ( iomodel->dim==2) _error_("2d meshes not supported yet");28 if (dim==2) _error_("2d meshes not supported yet"); 23 29 24 30 /*Recover pointer: */ … … 33 39 CreateSingleNodeToElementConnectivity(iomodel); 34 40 35 for (i=0;i< iomodel->numberofvertices;i++){41 for (i=0;i<numberofvertices;i++){ 36 42 37 43 if((iomodel->my_vertices[i]==1)){ -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateNodesMelting.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 20 21 21 22 /*DataSets: */ 22 23 Nodes* nodes = NULL; 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 23 27 24 28 /*Recover pointer: */ … … 39 43 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 40 44 41 for (i=0;i< iomodel->numberofvertices;i++){45 for (i=0;i<numberofvertices;i++){ 42 46 43 47 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp
r9343 r9356 16 16 void UpdateElementsMelting(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 21 /*Fetch parameters: */ 22 iomodel->parameters->FindParam(&dim,DimEnum); 23 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 24 18 25 /*Now, is the model 3d? otherwise, do nothing: */ 19 if ( iomodel->dim==2)return;26 if (dim==2)return; 20 27 21 28 /*Fetch data needed: */ … … 24 31 /*Update elements: */ 25 32 int counter=0; 26 for(int i=0;i< iomodel->numberofelements;i++){33 for(int i=0;i<numberofelements;i++){ 27 34 if(iomodel->my_elements[i]){ 28 35 Element* element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
r9340 r9356 20 20 int i; 21 21 int analysis_type; 22 int dim; 23 int verbose; 22 24 23 25 /*output: */ … … 30 32 Parameters *parameters = NULL; 31 33 34 32 35 /*Initialize IoModel from input file*/ 33 36 IoModel* iomodel = new IoModel(IOMODEL); 34 SetVerbosityLevel(iomodel->verbose); 37 38 /*Fetch parameters: */ 39 iomodel->parameters->FindParam(&dim,DimEnum); 40 iomodel->parameters->FindParam(&verbose,VerboseEnum); 41 42 SetVerbosityLevel(verbose); 35 43 36 44 for(i=0;i<nummodels;i++){ … … 39 47 40 48 /*Hack for trasient runs (to be improved)*/ 41 if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && iomodel->dim==2) continue;42 if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && iomodel->dim==2) continue;49 if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && dim==2) continue; 50 if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && dim==2) continue; 43 51 44 52 _printf_(VerboseMProcessor()," create datasets for analysis %s\n",EnumToStringx(analysis_type)); -
issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
r9340 r9356 36 36 37 37 /*as many nodes as there are vertices */ 38 int numberofvertices; 38 39 39 40 /*output: */ 40 41 bool* my_nodes=NULL; 41 42 42 my_nodes=(bool*)xmalloc(iomodel->numberofvertices*sizeof(bool)); 43 memcpy(my_nodes,my_vertices,iomodel->numberofvertices*sizeof(bool)); 43 /*Fetch parameters: */ 44 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 45 46 my_nodes=(bool*)xmalloc(numberofvertices*sizeof(bool)); 47 memcpy(my_nodes,my_vertices,numberofvertices*sizeof(bool)); 44 48 45 49 /*Assign output pointers:*/ … … 50 54 void DiscontinuousGalerkinNodesPartitioning(bool** pmy_nodes,bool* my_elements, int* my_vertices, IoModel* iomodel){ 51 55 56 int numberofelements; 57 58 /*Fetch parameters: */ 59 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 60 52 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 53 62 * the nodes and the vertices. The vertices are similar to continuous galerkin, but the nodes partitioning involves edges, which mess up sorting of … … 55 64 56 65 int i,j; 66 int dim; 57 67 58 68 /*output: */ … … 63 73 double e1,e2; 64 74 int pos; 75 int numberofedges; 76 77 /*Fetch parameters: */ 78 iomodel->parameters->FindParam(&dim,DimEnum); 65 79 66 80 /*Build discontinuous node partitioning … … 74 88 75 89 /*Allocate*/ 76 my_nodes=(bool*)xcalloc(3* iomodel->numberofelements,sizeof(int));90 my_nodes=(bool*)xcalloc(3*numberofelements,sizeof(int)); 77 91 78 92 /*First: add all the nodes of all the elements belonging to this cpu*/ 79 if ( iomodel->dim==2){80 for (i=0;i< iomodel->numberofelements;i++){93 if (dim==2){ 94 for (i=0;i<numberofelements;i++){ 81 95 if (my_elements[i]){ 82 96 my_nodes[3*i+0]=1; … … 93 107 94 108 /*Get edges and elements*/ 95 iomodel->FetchData(&iomodel->edges,& iomodel->numberofedges,&cols,EdgesEnum);109 iomodel->FetchData(&iomodel->edges,&numberofedges,&cols,EdgesEnum); 96 110 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 97 111 if (cols!=4) _error_("field edges should have 4 columns"); 98 112 99 113 /*!All elements have been partitioned above, only create elements for this CPU: */ 100 for (i=0;i< iomodel->numberofedges;i++){114 for (i=0;i<numberofedges;i++){ 101 115 102 116 /*Get left and right elements*/ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
r9340 r9356 10 10 void CreateConstraintsPrognostic(Constraints** pconstraints, IoModel* iomodel){ 11 11 12 int prognostic_DG; 13 14 /*Fetch parameters: */ 15 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 16 12 17 /*Output*/ 13 18 Constraints *constraints = NULL; … … 20 25 21 26 /*Do not add constraints in DG, they are weakly imposed*/ 22 if(! iomodel->prognostic_DG){27 if(!prognostic_DG){ 23 28 IoModelToConstraintsx(constraints,iomodel,SpcthicknessEnum,PrognosticAnalysisEnum); 24 29 } -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
r9340 r9356 18 18 int penpair_ids[2]; 19 19 int count=0; 20 int prognostic_DG; 21 int numberofedges; 22 int numpenalties; 20 23 21 24 /*DataSet*/ 22 25 Loads* loads = NULL; 26 27 /*Fetch parameters: */ 28 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 23 29 24 30 /*Recover pointer: */ … … 29 35 30 36 /*Loads only in DG*/ 31 if ( iomodel->prognostic_DG){37 if (prognostic_DG){ 32 38 33 39 /*Get edges and elements*/ 34 iomodel->FetchData(&iomodel->edges,& iomodel->numberofedges,NULL,EdgesEnum);40 iomodel->FetchData(&iomodel->edges,&numberofedges,NULL,EdgesEnum); 35 41 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 36 42 iomodel->FetchData(&iomodel->thickness,NULL,NULL,ThicknessEnum); 37 43 38 44 /*First load data:*/ 39 for (i=0;i< iomodel->numberofedges;i++){45 for (i=0;i<numberofedges;i++){ 40 46 41 47 /*Get left and right elements*/ … … 57 63 58 64 /*Create Penpair for penalties: */ 59 iomodel->FetchData(&iomodel->penalties,& iomodel->numpenalties,NULL,PenaltiesEnum);65 iomodel->FetchData(&iomodel->penalties,&numpenalties,NULL,PenaltiesEnum); 60 66 iomodel->FetchData(&iomodel->nodeonbed,NULL,NULL,NodeOnBedEnum); 61 67 62 for(i=0;i< iomodel->numpenalties;i++){68 for(i=0;i<numpenalties;i++){ 63 69 64 70 if(iomodel->my_vertices[(int)iomodel->penalties[2*i+0]-1]){ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp
r9340 r9356 21 21 int io_index; 22 22 bool continuous_galerkin=true; 23 int dim; 24 int numberofelements; 25 int numberofvertices; 26 int prognostic_DG; 23 27 24 28 /*DataSets: */ 25 29 Nodes* nodes = NULL; 30 31 /*Fetch parameters: */ 32 iomodel->parameters->FindParam(&dim,DimEnum); 33 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 34 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 35 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 26 36 27 37 /*Recover pointer: */ … … 32 42 33 43 /*Create partition of nodes: */ 34 if( iomodel->prognostic_DG) continuous_galerkin=false;44 if(prognostic_DG) continuous_galerkin=false; 35 45 NodesPartitioning(&iomodel->my_nodes,iomodel->my_elements,iomodel->my_vertices,iomodel,continuous_galerkin); 36 46 37 47 /*Check in 3d*/ 38 if( iomodel->prognostic_DG && iomodel->dim==3) _error_("DG 3d not implemented yet");48 if(prognostic_DG && dim==3) _error_("DG 3d not implemented yet"); 39 49 40 50 /*First fetch data: */ … … 50 60 51 61 /*Build Nodes dataset (Continuous Galerkin)*/ 52 for (i=0;i< iomodel->numberofvertices;i++){62 for (i=0;i<numberofvertices;i++){ 53 63 54 64 if(iomodel->my_vertices[i]){ … … 63 73 64 74 /*Build Nodes dataset -> 3 for each element (Discontinuous Galerkin)*/ 65 for (i=0;i< iomodel->numberofelements;i++){75 for (i=0;i<numberofelements;i++){ 66 76 for (j=0;j<3;j++){ 67 77 … … 71 81 vertex_id=(int)*(iomodel->elements+3*i+j); //(Matlab indexing) 72 82 io_index=vertex_id-1; //(C indexing) 73 _assert_(vertex_id>0 && vertex_id<= iomodel->numberofvertices);83 _assert_(vertex_id>0 && vertex_id<=numberofvertices); 74 84 75 85 //Compute Node id -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
r9343 r9356 16 16 void UpdateElementsPrognostic(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 int prognostic_DG; 21 18 22 /*Fetch data needed: */ 23 iomodel->parameters->FindParam(&dim,DimEnum); 19 24 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 25 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 26 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 20 27 21 28 /*Update elements: */ 22 29 int counter=0; 23 for(int i=0;i< iomodel->numberofelements;i++){30 for(int i=0;i<numberofelements;i++){ 24 31 if(iomodel->my_elements[i]){ 25 32 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 42 49 iomodel->FetchDataToInput(elements,VyEnum); 43 50 44 if( iomodel->prognostic_DG){51 if(prognostic_DG){ 45 52 iomodel->FetchDataToInput(elements,SpcthicknessEnum); //for DG, we need the spc in the element 46 53 } 47 54 48 if ( iomodel->dim==3){55 if (dim==3){ 49 56 iomodel->FetchDataToInput(elements,ElementOnBedEnum); 50 57 iomodel->FetchDataToInput(elements,ElementOnSurfaceEnum); -
issm/trunk/src/c/modules/ModelProcessorx/Qmu/CreateParametersQmu.cpp
r9340 r9356 52 52 int m,n; 53 53 int count; 54 bool qmu_analysis=false; 55 char* name=NULL; 56 int numberofresponses; 57 int numberofvertices; 54 58 55 59 /*}}}*/ … … 58 62 parameters=*pparameters; 59 63 60 parameters->AddObject(new BoolParam(QmuAnalysisEnum,iomodel->qmu_analysis)); 61 if(iomodel->qmu_analysis){ 64 /*recover parameters: */ 65 parameters->FindParam(&qmu_analysis,QmuAnalysisEnum); 66 parameters->FindParam(&name,NameEnum); 67 parameters->FindParam(&numberofresponses,NumberOfResponsesEnum); 68 parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 69 if(qmu_analysis){ 62 70 63 71 /*name of qmu input, error and output files:{{{1*/ 64 qmuinname=(char*)xmalloc((strlen( iomodel->name)+strlen(".qmu.in")+1)*sizeof(char));65 sprintf(qmuinname,"%s%s", iomodel->name,".qmu.in");72 qmuinname=(char*)xmalloc((strlen(name)+strlen(".qmu.in")+1)*sizeof(char)); 73 sprintf(qmuinname,"%s%s",name,".qmu.in"); 66 74 parameters->AddObject(new StringParam(QmuInNameEnum,qmuinname)); 67 75 68 qmuoutname=(char*)xmalloc((strlen( iomodel->name)+strlen(".qmu.out")+1)*sizeof(char));69 sprintf(qmuoutname,"%s%s", iomodel->name,".qmu.out");76 qmuoutname=(char*)xmalloc((strlen(name)+strlen(".qmu.out")+1)*sizeof(char)); 77 sprintf(qmuoutname,"%s%s",name,".qmu.out"); 70 78 parameters->AddObject(new StringParam(QmuOutNameEnum,qmuoutname)); 71 79 72 qmuerrname=(char*)xmalloc((strlen( iomodel->name)+strlen(".qmu.err")+1)*sizeof(char));73 sprintf(qmuerrname,"%s%s", iomodel->name,".qmu.err");80 qmuerrname=(char*)xmalloc((strlen(name)+strlen(".qmu.err")+1)*sizeof(char)); 81 sprintf(qmuerrname,"%s%s",name,".qmu.err"); 74 82 parameters->AddObject(new StringParam(QmuErrNameEnum,qmuerrname)); 75 83 /*}}}*/ … … 86 94 /*Ok, we have all the response descriptors. Build a parameter with it: */ 87 95 parameters->AddObject(new StringArrayParam(ResponsedescriptorsEnum,responsedescriptors,numresponsedescriptors)); 88 parameters->AddObject(new IntParam(QmuNumberOfResponsesEnum, iomodel->numberofresponses));96 parameters->AddObject(new IntParam(QmuNumberOfResponsesEnum,numberofresponses)); 89 97 /*}}}*/ 90 98 /*Deal with partitioning: {{{1*/ 91 99 /*partition vertices in iomodel->qmu_npart parts, unless a partition is already present: */ 92 parameters->AddObject(new IntParam(QmuNPartEnum,iomodel->qmu_npart));93 100 94 101 iomodel->FetchData(&dpart,NULL,NULL,PartEnum); … … 99 106 ElementsAndVerticesPartitioning(&iomodel->my_elements,&iomodel->my_vertices,iomodel); 100 107 101 dpart=(double*)xmalloc( iomodel->numberofvertices*sizeof(double));102 for(i=0;i< iomodel->numberofvertices;i++)dpart[i]=iomodel->my_vertices[i];103 } 104 parameters->AddObject(new DoubleVecParam(QmuPartEnum,dpart, iomodel->numberofvertices));108 dpart=(double*)xmalloc(numberofvertices*sizeof(double)); 109 for(i=0;i<numberofvertices;i++)dpart[i]=iomodel->my_vertices[i]; 110 } 111 parameters->AddObject(new DoubleVecParam(QmuPartEnum,dpart,numberofvertices)); 105 112 /*}}}*/ 106 113 /*Deal with data needed because of qmu variables: {{{1*/ … … 116 123 117 124 /*Convert units: */ 118 UnitConversion(dakota_parameter, iomodel->numberofvertices,ExtToIuEnum,StringToEnumx(tag));125 UnitConversion(dakota_parameter,numberofvertices,ExtToIuEnum,StringToEnumx(tag)); 119 126 120 127 /*Add to parameters: */ 121 parameters->AddObject(new DoubleVecParam(StringToEnumx(tag),dakota_parameter, iomodel->numberofvertices));128 parameters->AddObject(new DoubleVecParam(StringToEnumx(tag),dakota_parameter,numberofvertices)); 122 129 123 130 /*Free ressources:*/ … … 187 194 } 188 195 /*}}}*/ 189 parameters->AddObject(new BoolParam(QmuSaveFemmodelEnum,iomodel->qmu_save_femmodel));190 196 /*Free data: {{{1*/ 191 197 for(i=0;i<numresponsedescriptors;i++){ … … 208 214 xfree((void**)&qmuerrname); 209 215 xfree((void**)&qmuoutname); 210 /*}}}*/ 211 } //if(iomodel->qmu_analysis) 216 xfree((void**)&name); 217 /*}}}*/ 218 } //if(qmu_analysis) 212 219 213 220 /*Assign output pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 20 21 21 22 /*DataSets: */ 22 23 Nodes* nodes = NULL; 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 23 27 24 28 /*Recover pointer: */ … … 39 43 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 40 44 41 for (i=0;i< iomodel->numberofvertices;i++){45 for (i=0;i<numberofvertices;i++){ 42 46 43 47 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/SurfaceSlope/UpdateElementsSurfaceSlope.cpp
r9343 r9356 16 16 void UpdateElementsSurfaceSlope(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 18 21 /*Fetch data needed: */ 22 iomodel->parameters->FindParam(&dim,DimEnum); 19 23 iomodel->FetchData(&iomodel->elements,NULL,NULL,ElementsEnum); 24 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 20 25 21 26 /*Update elements: */ 22 27 int counter=0; 23 for(int i=0;i< iomodel->numberofelements;i++){28 for(int i=0;i<numberofelements;i++){ 24 29 if(iomodel->my_elements[i]){ 25 30 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 33 38 iomodel->FetchDataToInput(elements,ElementOnWaterEnum); 34 39 35 if ( iomodel->dim==3){40 if (dim==3){ 36 41 iomodel->FetchDataToInput(elements,ElementOnBedEnum); 37 42 iomodel->FetchDataToInput(elements,ElementOnSurfaceEnum); -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
r9340 r9356 17 17 int i; 18 18 int count; 19 int dim; 19 20 20 21 /*Output*/ 21 22 Constraints* constraints = NULL; 23 24 /*Fetch parameters: */ 25 iomodel->parameters->FindParam(&dim,DimEnum); 22 26 23 27 /*Recover pointer: */ … … 28 32 29 33 /*Only 3d mesh supported*/ 30 if ( iomodel->dim==3){34 if (dim==3){ 31 35 IoModelToConstraintsx(constraints,iomodel,SpctemperatureEnum,ThermalAnalysisEnum); 32 36 } -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
r9340 r9356 15 15 /*Intermediary*/ 16 16 int i; 17 int dim; 18 int numberofvertices; 17 19 18 20 /*DataSet*/ … … 23 25 loads=*ploads; 24 26 27 /*Fetch parameters: */ 28 iomodel->parameters->FindParam(&dim,DimEnum); 29 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 30 25 31 /*Create loads if they do not exist yet*/ 26 32 if(!loads) loads = new Loads(LoadsEnum); 27 33 28 34 /*return if 2d mesh*/ 29 if ( iomodel->dim==2) _error_("2d meshes not supported yet");35 if (dim==2) _error_("2d meshes not supported yet"); 30 36 31 37 //create penalties for nodes: no node can have a temperature over the melting point … … 34 40 CreateSingleNodeToElementConnectivity(iomodel); 35 41 36 for (i=0;i< iomodel->numberofvertices;i++){42 for (i=0;i<numberofvertices;i++){ 37 43 38 44 /*keep only this partition's nodes:*/ -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp
r9340 r9356 18 18 int i; 19 19 bool continuous_galerkin=true; 20 int numberofvertices; 20 21 21 22 /*DataSets: */ 22 23 Nodes* nodes = NULL; 23 24 25 /*Fetch parameters: */ 26 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 27 24 28 /*Recover pointer: */ 25 29 nodes=*pnodes; … … 39 43 iomodel->FetchData(&iomodel->nodeonwater,NULL,NULL,NodeOnWaterEnum); 40 44 41 for (i=0;i< iomodel->numberofvertices;i++){45 for (i=0;i<numberofvertices;i++){ 42 46 43 47 if(iomodel->my_vertices[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp
r9343 r9356 16 16 void UpdateElementsThermal(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 17 17 18 int dim; 19 int numberofelements; 20 bool qmu_analysis; 21 22 /*Fetch parameters: */ 23 iomodel->parameters->FindParam(&dim,DimEnum); 24 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 25 iomodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum); 26 18 27 /*Now, is the model 3d? otherwise, do nothing: */ 19 if ( iomodel->dim==2)return;28 if (dim==2)return; 20 29 21 30 /*Fetch data needed: */ … … 24 33 /*Update elements: */ 25 34 int counter=0; 26 for(int i=0;i< iomodel->numberofelements;i++){35 for(int i=0;i<numberofelements;i++){ 27 36 if(iomodel->my_elements[i]){ 28 37 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 53 62 iomodel->FetchDataToInput(elements,VzEnum); 54 63 55 if( iomodel->qmu_analysis)elements->InputDuplicate(TemperatureEnum,QmuTemperatureEnum);64 if(qmu_analysis)elements->InputDuplicate(TemperatureEnum,QmuTemperatureEnum); 56 65 57 66 /*Free data: */ -
issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
r9291 r9356 143 143 else if (strcmp(name,"Adjointz")==0) return AdjointzEnum; 144 144 else if (strcmp(name,"Adjointp")==0) return AdjointpEnum; 145 else if (strcmp(name," ArtDiff")==0) return ArtDiffEnum;145 else if (strcmp(name,"Fake35")==0) return Fake35Enum; 146 146 else if (strcmp(name,"Bed")==0) return BedEnum; 147 147 else if (strcmp(name,"Bathymetry")==0) return BathymetryEnum; … … 153 153 else if (strcmp(name,"Fake2")==0) return Fake2Enum; 154 154 else if (strcmp(name,"Constant")==0) return ConstantEnum; 155 else if (strcmp(name," NumControls")==0) return NumControlsEnum;155 else if (strcmp(name,"Fake37")==0) return Fake37Enum; 156 156 else if (strcmp(name,"ControlType")==0) return ControlTypeEnum; 157 157 else if (strcmp(name,"Converged")==0) return ConvergedEnum; … … 348 348 else if (strcmp(name,"QmuInName")==0) return QmuInNameEnum; 349 349 else if (strcmp(name,"QmuMassFluxSegments")==0) return QmuMassFluxSegmentsEnum; 350 else if (strcmp(name," QmuNPart")==0) return QmuNPartEnum;350 else if (strcmp(name,"Fake39")==0) return Fake39Enum; 351 351 else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum; 352 352 else if (strcmp(name,"QmuPart")==0) return QmuPartEnum; … … 370 370 else if (strcmp(name,"Fset")==0) return FsetEnum; 371 371 else if (strcmp(name,"Sset")==0) return SsetEnum; 372 else if (strcmp(name,"Grounding LineMigration")==0) return GroundingLineMigrationEnum;372 else if (strcmp(name,"GroundinglineMigration")==0) return GroundinglineMigrationEnum; 373 373 else if (strcmp(name,"Yts")==0) return YtsEnum; 374 374 else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum; … … 399 399 else if (strcmp(name,"VelAbsGradient")==0) return VelAbsGradientEnum; 400 400 else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum; 401 else if (strcmp(name," NumResponses")==0) return NumResponsesEnum;401 else if (strcmp(name,"Fake38")==0) return Fake38Enum; 402 402 else if (strcmp(name,"StepResponses")==0) return StepResponsesEnum; 403 403 else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum; … … 429 429 else if (strcmp(name,"NodeOnHutter")==0) return NodeOnHutterEnum; 430 430 else if (strcmp(name,"Z")==0) return ZEnum; 431 else if (strcmp(name," GlMigration")==0) return GlMigrationEnum;431 else if (strcmp(name,"Fake36")==0) return Fake36Enum; 432 432 else if (strcmp(name,"Riftinfo")==0) return RiftinfoEnum; 433 433 else if (strcmp(name,"ElementOnIceSheet")==0) return ElementOnIceSheetEnum; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r9320 r9356 49 49 Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels) 50 50 :PentaRef(nummodels) 51 ,PentaHook(nummodels,index+1,iomodel ->numberofelements+1) //index+1: matice id, iomodel->numberofelements+1: matpar id51 ,PentaHook(nummodels,index+1,iomodel) //index+1: matice id, iomodel->numberofelements+1: matpar id 52 52 { //i is the element index 53 53 … … 1881 1881 thermalconductivity=matpar->GetThermalConductivity(); 1882 1882 this->parameters->FindParam(&dt,DtEnum); 1883 this->parameters->FindParam(&artdiff,Art DiffEnum);1883 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 1884 1884 this->parameters->FindParam(&epsvel,EpsvelEnum); 1885 1885 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); … … 2155 2155 thermalconductivity=matpar->GetThermalConductivity(); 2156 2156 this->parameters->FindParam(&dt,DtEnum); 2157 this->parameters->FindParam(&artdiff,Art DiffEnum);2157 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 2158 2158 this->parameters->FindParam(&epsvel,EpsvelEnum); 2159 2159 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); … … 3318 3318 thermalconductivity=matpar->GetThermalConductivity(); 3319 3319 this->parameters->FindParam(&dt,DtEnum); 3320 this->parameters->FindParam(&artdiff,Art DiffEnum);3320 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 3321 3321 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 3322 3322 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); … … 3587 3587 thermalconductivity=matpar->GetThermalConductivity(); 3588 3588 this->parameters->FindParam(&dt,DtEnum); 3589 this->parameters->FindParam(&artdiff,Art DiffEnum);3589 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 3590 3590 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 3591 3591 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); … … 4467 4467 int *responses = NULL; 4468 4468 int num_responses,resp; 4469 this->parameters->FindParam(&num_responses,Num ResponsesEnum);4469 this->parameters->FindParam(&num_responses,NumCmResponsesEnum); 4470 4470 this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 4471 4471 … … 4795 4795 4796 4796 /*retrieve some parameters: */ 4797 this->parameters->FindParam(&num_controls,NumControl sEnum);4797 this->parameters->FindParam(&num_controls,NumControlTypeEnum); 4798 4798 this->parameters->FindParam(&control_type,NULL,ControlTypeEnum); 4799 4799 … … 4853 4853 double time; 4854 4854 TransientInput* transientinput=NULL; 4855 4855 4856 int numberofvertices; 4857 int numberofelements; 4858 double yts; 4859 4860 /*Fetch parameters: */ 4861 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 4862 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 4863 iomodel->parameters->FindParam(&yts,YtsEnum); 4864 4856 4865 /*Branch on type of vector: nodal or elementary: */ 4857 4866 if(vector_type==1){ //nodal vector … … 4863 4872 4864 4873 /*Are we in transient or static? */ 4865 if(M== iomodel->numberofvertices){4874 if(M==numberofvertices){ 4866 4875 4867 4876 /*create input values: */ … … 4874 4883 this->inputs->AddInput(new PentaVertexInput(vector_enum,nodeinputs)); 4875 4884 } 4876 else if(M== iomodel->numberofvertices+1){4885 else if(M==numberofvertices+1){ 4877 4886 /*create transient input: */ 4878 4887 for(t=0;t<N;t++){ //N is the number of times … … 4888 4897 4889 4898 /*time? :*/ 4890 time=(double)vector[(M-1)*N+t]* iomodel->yts;4899 time=(double)vector[(M-1)*N+t]*yts; 4891 4900 4892 4901 if(t==0)transientinput=new TransientInput(vector_enum); … … 4895 4904 this->inputs->AddInput(transientinput); 4896 4905 } 4897 else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long. Enum %s", iomodel->numberofvertices,M,EnumToStringx(vector_enum));4906 else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long. Enum %s",numberofvertices,M,EnumToStringx(vector_enum)); 4898 4907 } 4899 4908 else if(vector_type==2){ //element vector 4900 4909 /*Are we in transient or static? */ 4901 if(M== iomodel->numberofelements){4910 if(M==numberofelements){ 4902 4911 4903 4912 /*static mode: create an input out of the element value: */ … … 5153 5162 double cmmaxinputs[6]; 5154 5163 5164 double yts; 5165 int control_analysis; 5166 int num_control_type; 5167 int num_cm_responses; 5168 5169 /*Fetch parameters: */ 5170 iomodel->parameters->FindParam(&yts,YtsEnum); 5171 iomodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum); 5172 iomodel->parameters->FindParam(&num_control_type,NumControlTypeEnum); 5173 iomodel->parameters->FindParam(&num_cm_responses,NumCmResponsesEnum); 5174 5155 5175 /*Checks if debuging*/ 5156 5176 /*{{{2*/ … … 5165 5185 5166 5186 /*Control Inputs*/ 5167 if ( iomodel->control_analysis && iomodel->control_type){5168 for(i=0;i< iomodel->num_control_type;i++){5187 if (control_analysis && iomodel->control_type){ 5188 for(i=0;i<num_control_type;i++){ 5169 5189 switch((int)iomodel->control_type[i]){ 5170 5190 case DhdtEnum: 5171 5191 if (iomodel->dhdt){ 5172 for(j=0;j<6;j++)nodeinputs[j]=iomodel->dhdt[penta_vertex_ids[j]-1]/ iomodel->yts;5173 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;5174 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;5192 for(j=0;j<6;j++)nodeinputs[j]=iomodel->dhdt[penta_vertex_ids[j]-1]/yts; 5193 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)*num_control_type+i]/yts; 5194 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)*num_control_type+i]/yts; 5175 5195 this->inputs->AddInput(new ControlInput(DhdtEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5176 5196 } … … 5178 5198 case VxEnum: 5179 5199 if (iomodel->vx){ 5180 for(j=0;j<6;j++)nodeinputs[j]=iomodel->vx[penta_vertex_ids[j]-1]/ iomodel->yts;5181 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;5182 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;5200 for(j=0;j<6;j++)nodeinputs[j]=iomodel->vx[penta_vertex_ids[j]-1]/yts; 5201 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)*num_control_type+i]/yts; 5202 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)*num_control_type+i]/yts; 5183 5203 this->inputs->AddInput(new ControlInput(VxEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5184 5204 } … … 5186 5206 case VyEnum: 5187 5207 if (iomodel->vy){ 5188 for(j=0;j<6;j++)nodeinputs[j]=iomodel->vy[penta_vertex_ids[j]-1]/ iomodel->yts;5189 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;5190 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;5208 for(j=0;j<6;j++)nodeinputs[j]=iomodel->vy[penta_vertex_ids[j]-1]/yts; 5209 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)*num_control_type+i]/yts; 5210 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)*num_control_type+i]/yts; 5191 5211 this->inputs->AddInput(new ControlInput(VyEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5192 5212 } … … 5195 5215 if (iomodel->drag_coefficient){ 5196 5216 for(j=0;j<6;j++)nodeinputs[j]=iomodel->drag_coefficient[penta_vertex_ids[j]-1]; 5197 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i];5198 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)* iomodel->num_control_type+i];5217 for(j=0;j<6;j++)cmmininputs[j]=iomodel->cm_min[(penta_vertex_ids[j]-1)*num_control_type+i]; 5218 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->cm_max[(penta_vertex_ids[j]-1)*num_control_type+i]; 5199 5219 this->inputs->AddInput(new ControlInput(DragCoefficientEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 5200 5220 } … … 5244 5264 /*Create inputs and add to DataSetInput*/ 5245 5265 DatasetInput* datasetinput=new DatasetInput(WeightsEnum); 5246 for(i=0;i< iomodel->num_cm_responses;i++){5247 for(j=0;j<6;j++)nodeinputs[j]=iomodel->weights[(penta_vertex_ids[j]-1)* iomodel->num_cm_responses+i];5266 for(i=0;i<num_cm_responses;i++){ 5267 for(j=0;j<6;j++)nodeinputs[j]=iomodel->weights[(penta_vertex_ids[j]-1)*num_cm_responses+i]; 5248 5268 datasetinput->inputs->AddObject(new PentaVertexInput(WeightsEnum,nodeinputs)); 5249 5269 } … … 7493 7513 int penta_vertex_ids[6]; 7494 7514 double nodeinputs[6]; 7515 double yts; 7516 int prognostic_DG; 7517 bool qmu_analysis; 7518 int isstokes; 7519 double beta,heatcapacity,referencetemperature,meltingpoint,latentheat; 7520 7521 /*Fetch parameters: */ 7522 iomodel->parameters->FindParam(&yts,YtsEnum); 7523 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 7524 iomodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum); 7525 iomodel->parameters->FindParam(&isstokes,IsstokesEnum); 7526 iomodel->parameters->FindParam(&beta,BetaEnum); 7527 iomodel->parameters->FindParam(&heatcapacity,HeatcapacityEnum); 7528 iomodel->parameters->FindParam(&referencetemperature,ReferencetemperatureEnum); 7529 iomodel->parameters->FindParam(&meltingpoint,MeltingpointEnum); 7530 iomodel->parameters->FindParam(&latentheat,LatentheatEnum); 7531 7495 7532 7496 7533 /*Checks if debuging*/ … … 7500 7537 7501 7538 /*Recover element type*/ 7502 if ((analysis_type==PrognosticAnalysisEnum || analysis_type==BalancethicknessAnalysisEnum) && iomodel->prognostic_DG){7539 if ((analysis_type==PrognosticAnalysisEnum || analysis_type==BalancethicknessAnalysisEnum) && prognostic_DG){ 7503 7540 /*P1 Discontinuous Galerkin*/ 7504 7541 penta_type=P1DGEnum; … … 7533 7570 /*default vx,vy and vz: either observation or 0 */ 7534 7571 if(!iomodel->vx){ 7535 if (iomodel->vx_obs) for(i=0;i<6;i++)nodeinputs[i]=iomodel->vx_obs[penta_vertex_ids[i]-1]/ iomodel->yts;7572 if (iomodel->vx_obs) for(i=0;i<6;i++)nodeinputs[i]=iomodel->vx_obs[penta_vertex_ids[i]-1]/yts; 7536 7573 else for(i=0;i<6;i++)nodeinputs[i]=0; 7537 7574 this->inputs->AddInput(new PentaVertexInput(VxEnum,nodeinputs)); 7538 7575 this->inputs->AddInput(new PentaVertexInput(VxPicardEnum,nodeinputs)); 7539 if( iomodel->qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVxEnum,nodeinputs));7576 if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVxEnum,nodeinputs)); 7540 7577 } 7541 7578 if(!iomodel->vy){ 7542 if (iomodel->vy_obs) for(i=0;i<6;i++)nodeinputs[i]=iomodel->vy_obs[penta_vertex_ids[i]-1]/ iomodel->yts;7579 if (iomodel->vy_obs) for(i=0;i<6;i++)nodeinputs[i]=iomodel->vy_obs[penta_vertex_ids[i]-1]/yts; 7543 7580 else for(i=0;i<6;i++)nodeinputs[i]=0; 7544 7581 this->inputs->AddInput(new PentaVertexInput(VyEnum,nodeinputs)); 7545 7582 this->inputs->AddInput(new PentaVertexInput(VyPicardEnum,nodeinputs)); 7546 if( iomodel->qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVyEnum,nodeinputs));7583 if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVyEnum,nodeinputs)); 7547 7584 } 7548 7585 if(!iomodel->vz){ 7549 if (iomodel->vz_obs) for(i=0;i<6;i++)nodeinputs[i]=iomodel->vz_obs[penta_vertex_ids[i]-1]/ iomodel->yts;7586 if (iomodel->vz_obs) for(i=0;i<6;i++)nodeinputs[i]=iomodel->vz_obs[penta_vertex_ids[i]-1]/yts; 7550 7587 else for(i=0;i<6;i++)nodeinputs[i]=0; 7551 7588 this->inputs->AddInput(new PentaVertexInput(VzEnum,nodeinputs)); 7552 7589 this->inputs->AddInput(new PentaVertexInput(VzPicardEnum,nodeinputs)); 7553 if( iomodel->qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVzEnum,nodeinputs));7590 if(qmu_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVzEnum,nodeinputs)); 7554 7591 } 7555 7592 if(!iomodel->pressure){ 7556 7593 for(i=0;i<6;i++)nodeinputs[i]=0; 7557 if( iomodel->qmu_analysis){7594 if(qmu_analysis){ 7558 7595 this->inputs->AddInput(new PentaVertexInput(PressureEnum,nodeinputs)); 7559 7596 this->inputs->AddInput(new PentaVertexInput(QmuPressureEnum,nodeinputs)); 7560 7597 } 7561 if(i omodel->isstokes){7598 if(isstokes){ 7562 7599 this->inputs->AddInput(new PentaVertexInput(PressureEnum,nodeinputs)); 7563 7600 this->inputs->AddInput(new PentaVertexInput(PressurePicardEnum,nodeinputs)); … … 7567 7604 /*Create VzPattyn and VzStokes Enums*/ 7568 7605 if(iomodel->vz && iomodel->nodeonstokes){ 7569 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/ iomodel->yts*iomodel->nodeonstokes[penta_vertex_ids[i]-1];7606 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/yts*iomodel->nodeonstokes[penta_vertex_ids[i]-1]; 7570 7607 this->inputs->AddInput(new PentaVertexInput(VzStokesEnum,nodeinputs)); 7571 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/ iomodel->yts*(1-iomodel->nodeonstokes[penta_vertex_ids[i]-1]);7608 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/yts*(1-iomodel->nodeonstokes[penta_vertex_ids[i]-1]); 7572 7609 this->inputs->AddInput(new PentaVertexInput(VzPattynEnum,nodeinputs)); 7573 7610 } … … 7581 7618 /*Create VzMacAyeal and VzStokes Enums*/ 7582 7619 if(iomodel->vz && iomodel->nodeonstokes){ 7583 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/ iomodel->yts*iomodel->nodeonstokes[penta_vertex_ids[i]-1];7620 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/yts*iomodel->nodeonstokes[penta_vertex_ids[i]-1]; 7584 7621 this->inputs->AddInput(new PentaVertexInput(VzStokesEnum,nodeinputs)); 7585 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/ iomodel->yts*(1-iomodel->nodeonstokes[penta_vertex_ids[i]-1]);7622 for(i=0;i<6;i++) nodeinputs[i]=iomodel->vz[penta_vertex_ids[i]-1]/yts*(1-iomodel->nodeonstokes[penta_vertex_ids[i]-1]); 7586 7623 this->inputs->AddInput(new PentaVertexInput(VzMacAyealEnum,nodeinputs)); 7587 7624 } … … 7610 7647 if (iomodel->temperature && iomodel->waterfraction) { 7611 7648 for(i=0;i<6;i++){ 7612 if(iomodel->temperature[penta_vertex_ids[i]-1] < iomodel->meltingpoint-iomodel->beta*iomodel->pressure[penta_vertex_ids[i]-1]){7613 nodeinputs[i]= iomodel->heatcapacity*(iomodel->temperature[penta_vertex_ids[i]-1]-iomodel->referencetemperature);7649 if(iomodel->temperature[penta_vertex_ids[i]-1] < meltingpoint-beta*iomodel->pressure[penta_vertex_ids[i]-1]){ 7650 nodeinputs[i]=heatcapacity*(iomodel->temperature[penta_vertex_ids[i]-1]-referencetemperature); 7614 7651 } 7615 else nodeinputs[i]= iomodel->heatcapacity*7616 ( iomodel->meltingpoint-iomodel->beta*iomodel->pressure[penta_vertex_ids[i]-1]-iomodel->referencetemperature)7617 + iomodel->latentheat*iomodel->waterfraction[penta_vertex_ids[i]-1];7652 else nodeinputs[i]=heatcapacity* 7653 (meltingpoint-beta*iomodel->pressure[penta_vertex_ids[i]-1]-referencetemperature) 7654 +latentheat*iomodel->waterfraction[penta_vertex_ids[i]-1]; 7618 7655 } 7619 7656 this->inputs->AddInput(new PentaVertexInput(EnthalpyEnum,nodeinputs)); -
issm/trunk/src/c/objects/Elements/PentaHook.cpp
r9320 r9356 45 45 /*}}}*/ 46 46 /*FUNCTION PentaHook::PentaHook(int in_numanalyses,int matice_id, int matpar_id){{{1*/ 47 PentaHook::PentaHook(int in_numanalyses,int matice_id, int matpar_id){ 47 PentaHook::PentaHook(int in_numanalyses,int matice_id, IoModel* iomodel){ 48 49 /*intermediary: */ 50 int matpar_id; 48 51 52 /*retrieve parameters: */ 53 iomodel->parameters->FindParam(&matpar_id,NumberOfElementsEnum); matpar_id++; 54 49 55 this->numanalyses=in_numanalyses; 50 56 this->hnodes=new Hook*[in_numanalyses]; -
issm/trunk/src/c/objects/Elements/PentaHook.h
r4396 r9356 8 8 class Hook; 9 9 class TriaHook; 10 class IoModel; 10 11 11 12 class PentaHook{ … … 20 21 /*FUNCTION constructors, destructors {{{1*/ 21 22 PentaHook(); 22 PentaHook(int in_numanalyses,int matice_id, int matpar_id);23 PentaHook(int in_numanalyses,int matice_id, IoModel* iomodel); 23 24 ~PentaHook(); 24 25 void SetHookNodes(int* node_ids,int analysis_counter); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r9320 r9356 41 41 Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels) 42 42 :TriaRef(nummodels) 43 ,TriaHook(nummodels,index+1,iomodel ->numberofelements+1){43 ,TriaHook(nummodels,index+1,iomodel){ 44 44 45 45 int i; … … 534 534 /*Retrieve all Inputs and parameters: */ 535 535 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 536 this->parameters->FindParam(&artdiff,Art DiffEnum);536 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 537 537 this->parameters->FindParam(&dim,DimEnum); 538 538 Input* vxaverage_input=NULL; … … 861 861 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 862 862 this->parameters->FindParam(&dt,DtEnum); 863 this->parameters->FindParam(&artdiff,Art DiffEnum);863 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 864 864 Input* vx_input=inputs->GetInput(HydrologyWaterVxEnum); _assert_(vx_input); 865 865 Input* vy_input=inputs->GetInput(HydrologyWaterVyEnum); _assert_(vy_input); … … 1020 1020 this->parameters->FindParam(&dt,DtEnum); 1021 1021 this->parameters->FindParam(&dim,DimEnum); 1022 this->parameters->FindParam(&artdiff,Art DiffEnum);1022 this->parameters->FindParam(&artdiff,ArtificialDiffusivityEnum); 1023 1023 Input* vxaverage_input=NULL; 1024 1024 Input* vyaverage_input=NULL; … … 1462 1462 /*Retrieve all inputs and parameters*/ 1463 1463 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1464 this->parameters->FindParam(&num_responses,Num ResponsesEnum);1464 this->parameters->FindParam(&num_responses,NumCmResponsesEnum); 1465 1465 this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 1466 1466 Input* thickness_input = inputs->GetInput(ThicknessEnum); _assert_(thickness_input); … … 1528 1528 /*Retrieve all inputs and parameters*/ 1529 1529 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1530 this->parameters->FindParam(&num_responses,Num ResponsesEnum);1530 this->parameters->FindParam(&num_responses,NumCmResponsesEnum); 1531 1531 this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 1532 1532 this->parameters->FindParam(&meanvel,MeanvelEnum); … … 1704 1704 /*Retrieve all inputs and parameters*/ 1705 1705 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 1706 this->parameters->FindParam(&num_responses,Num ResponsesEnum);1706 this->parameters->FindParam(&num_responses,NumCmResponsesEnum); 1707 1707 this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 1708 1708 this->parameters->FindParam(&meanvel,MeanvelEnum); … … 2718 2718 int *responses = NULL; 2719 2719 int num_responses,resp; 2720 this->parameters->FindParam(&num_responses,Num ResponsesEnum);2720 this->parameters->FindParam(&num_responses,NumCmResponsesEnum); 2721 2721 this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 2722 2722 … … 3112 3112 3113 3113 /*retrieve some parameters: */ 3114 this->parameters->FindParam(&num_controls,NumControl sEnum);3114 this->parameters->FindParam(&num_controls,NumControlTypeEnum); 3115 3115 this->parameters->FindParam(&control_type,NULL,ControlTypeEnum); 3116 3116 … … 3271 3271 double cmmininputs[3]; 3272 3272 double cmmaxinputs[3]; 3273 bool control_analysis=false; 3274 int num_control_type; 3275 double yts; 3276 int num_cm_responses; 3277 3273 3278 3274 3279 /*Checks if debuging*/ … … 3277 3282 /*}}}*/ 3278 3283 3284 /*Get parameters: */ 3285 iomodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum); 3286 iomodel->parameters->FindParam(&num_control_type,NumControlTypeEnum); 3287 iomodel->parameters->FindParam(&yts,YtsEnum); 3288 iomodel->parameters->FindParam(&num_cm_responses,NumCmResponsesEnum); 3289 3279 3290 /*Recover vertices ids needed to initialize inputs*/ 3280 3291 for(i=0;i<3;i++){ … … 3283 3294 3284 3295 /*Control Inputs*/ 3285 if ( iomodel->control_analysis && iomodel->control_type){3286 for(i=0;i< iomodel->num_control_type;i++){3296 if (control_analysis && iomodel->control_type){ 3297 for(i=0;i<num_control_type;i++){ 3287 3298 switch((int)iomodel->control_type[i]){ 3288 3299 case DhdtEnum: 3289 3300 if (iomodel->dhdt){ 3290 for(j=0;j<3;j++)nodeinputs[j]=iomodel->dhdt[tria_vertex_ids[j]-1]/ iomodel->yts;3291 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;3292 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;3301 for(j=0;j<3;j++)nodeinputs[j]=iomodel->dhdt[tria_vertex_ids[j]-1]/yts; 3302 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 3303 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 3293 3304 this->inputs->AddInput(new ControlInput(DhdtEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3294 3305 } … … 3296 3307 case VxEnum: 3297 3308 if (iomodel->vx){ 3298 for(j=0;j<3;j++)nodeinputs[j]=iomodel->vx[tria_vertex_ids[j]-1]/ iomodel->yts;3299 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;3300 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;3309 for(j=0;j<3;j++)nodeinputs[j]=iomodel->vx[tria_vertex_ids[j]-1]/yts; 3310 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 3311 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 3301 3312 this->inputs->AddInput(new ControlInput(VxEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3302 3313 } … … 3304 3315 case VyEnum: 3305 3316 if (iomodel->vy){ 3306 for(j=0;j<3;j++)nodeinputs[j]=iomodel->vy[tria_vertex_ids[j]-1]/ iomodel->yts;3307 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;3308 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i]/iomodel->yts;3317 for(j=0;j<3;j++)nodeinputs[j]=iomodel->vy[tria_vertex_ids[j]-1]/yts; 3318 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 3319 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 3309 3320 this->inputs->AddInput(new ControlInput(VyEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3310 3321 } … … 3313 3324 if (iomodel->drag_coefficient){ 3314 3325 for(j=0;j<3;j++)nodeinputs[j]=iomodel->drag_coefficient[tria_vertex_ids[j]-1]; 3315 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i];3316 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)* iomodel->num_control_type+i];3326 for(j=0;j<3;j++)cmmininputs[j]=iomodel->cm_min[(tria_vertex_ids[j]-1)*num_control_type+i]; 3327 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->cm_max[(tria_vertex_ids[j]-1)*num_control_type+i]; 3317 3328 this->inputs->AddInput(new ControlInput(DragCoefficientEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 3318 3329 } … … 3331 3342 /*Create inputs and add to DataSetInput*/ 3332 3343 DatasetInput* datasetinput=new DatasetInput(WeightsEnum); 3333 for(i=0;i< iomodel->num_cm_responses;i++){3334 for(j=0;j<3;j++)nodeinputs[j]=iomodel->weights[(tria_vertex_ids[j]-1)* iomodel->num_cm_responses+i];3344 for(i=0;i<num_cm_responses;i++){ 3345 for(j=0;j<3;j++)nodeinputs[j]=iomodel->weights[(tria_vertex_ids[j]-1)*num_cm_responses+i]; 3335 3346 datasetinput->inputs->AddObject(new TriaVertexInput(WeightsEnum,nodeinputs)); 3336 3347 } … … 3893 3904 double time; 3894 3905 TransientInput* transientinput=NULL; 3906 int numberofvertices; 3907 int numberofelements; 3908 double yts; 3909 3910 3911 /*Fetch parameters: */ 3912 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 3913 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 3914 iomodel->parameters->FindParam(&yts,YtsEnum); 3895 3915 3896 3916 /*Branch on type of vector: nodal or elementary: */ … … 3903 3923 3904 3924 /*Are we in transient or static? */ 3905 if(M== iomodel->numberofvertices){3925 if(M==numberofvertices){ 3906 3926 3907 3927 /*create input values: */ … … 3914 3934 this->inputs->AddInput(new TriaVertexInput(vector_enum,nodeinputs)); 3915 3935 } 3916 else if(M== iomodel->numberofvertices+1){3936 else if(M==numberofvertices+1){ 3917 3937 /*create transient input: */ 3918 3938 for(t=0;t<N;t++){ //N is the number of times … … 3928 3948 3929 3949 /*time? :*/ 3930 time=(double)vector[(M-1)*N+t]* iomodel->yts;3950 time=(double)vector[(M-1)*N+t]*yts; 3931 3951 3932 3952 if(t==0) transientinput=new TransientInput(vector_enum); … … 3935 3955 this->inputs->AddInput(transientinput); 3936 3956 } 3937 else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long", iomodel->numberofvertices,M);3957 else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long",numberofvertices,M); 3938 3958 } 3939 3959 else if(vector_type==2){ //element vector 3940 3960 /*Are we in transient or static? */ 3941 if(M== iomodel->numberofelements){3961 if(M==numberofelements){ 3942 3962 3943 3963 /*static mode: create an input out of the element value: */ … … 5201 5221 int tria_type; 5202 5222 double nodeinputs[3]; 5223 double yts; 5224 int prognostic_DG; 5225 bool qmu_analysis; 5203 5226 5204 5227 /*Checks if debuging*/ … … 5207 5230 /*}}}*/ 5208 5231 5232 /*Fetch parameters: */ 5233 iomodel->parameters->FindParam(&yts,YtsEnum); 5234 iomodel->parameters->FindParam(&prognostic_DG,PrognosticDGEnum); 5235 iomodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum); 5236 5209 5237 /*Recover element type*/ 5210 if ((analysis_type==PrognosticAnalysisEnum || analysis_type==BalancethicknessAnalysisEnum) && iomodel->prognostic_DG){5238 if ((analysis_type==PrognosticAnalysisEnum || analysis_type==BalancethicknessAnalysisEnum) && prognostic_DG){ 5211 5239 /*P1 Discontinuous Galerkin*/ 5212 5240 tria_type=P1DGEnum; … … 5250 5278 /*default vx,vy and vz: either observation or 0 */ 5251 5279 if(!iomodel->vx){ 5252 if (iomodel->vx_obs) for(i=0;i<3;i++)nodeinputs[i]=iomodel->vx_obs[tria_vertex_ids[i]-1]/ iomodel->yts;5280 if (iomodel->vx_obs) for(i=0;i<3;i++)nodeinputs[i]=iomodel->vx_obs[tria_vertex_ids[i]-1]/yts; 5253 5281 else for(i=0;i<3;i++)nodeinputs[i]=0; 5254 5282 this->inputs->AddInput(new TriaVertexInput(VxEnum,nodeinputs)); 5255 5283 this->inputs->AddInput(new TriaVertexInput(VxPicardEnum,nodeinputs)); 5256 if( iomodel->qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVxEnum,nodeinputs));5284 if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVxEnum,nodeinputs)); 5257 5285 } 5258 5286 if(!iomodel->vy){ 5259 if (iomodel->vy_obs) for(i=0;i<3;i++)nodeinputs[i]=iomodel->vy_obs[tria_vertex_ids[i]-1]/ iomodel->yts;5287 if (iomodel->vy_obs) for(i=0;i<3;i++)nodeinputs[i]=iomodel->vy_obs[tria_vertex_ids[i]-1]/yts; 5260 5288 else for(i=0;i<3;i++)nodeinputs[i]=0; 5261 5289 this->inputs->AddInput(new TriaVertexInput(VyEnum,nodeinputs)); 5262 5290 this->inputs->AddInput(new TriaVertexInput(VyPicardEnum,nodeinputs)); 5263 if( iomodel->qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVyEnum,nodeinputs));5291 if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVyEnum,nodeinputs)); 5264 5292 } 5265 5293 if(!iomodel->vz){ 5266 if (iomodel->vz_obs) for(i=0;i<3;i++)nodeinputs[i]=iomodel->vz_obs[tria_vertex_ids[i]-1]/ iomodel->yts;5294 if (iomodel->vz_obs) for(i=0;i<3;i++)nodeinputs[i]=iomodel->vz_obs[tria_vertex_ids[i]-1]/yts; 5267 5295 else for(i=0;i<3;i++)nodeinputs[i]=0; 5268 5296 this->inputs->AddInput(new TriaVertexInput(VzEnum,nodeinputs)); 5269 5297 this->inputs->AddInput(new TriaVertexInput(VzPicardEnum,nodeinputs)); 5270 if( iomodel->qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVzEnum,nodeinputs));5298 if(qmu_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVzEnum,nodeinputs)); 5271 5299 } 5272 5300 if(!iomodel->pressure){ 5273 5301 for(i=0;i<3;i++)nodeinputs[i]=0; 5274 if( iomodel->qmu_analysis){5302 if(qmu_analysis){ 5275 5303 this->inputs->AddInput(new TriaVertexInput(PressureEnum,nodeinputs)); 5276 5304 this->inputs->AddInput(new TriaVertexInput(QmuPressureEnum,nodeinputs)); -
issm/trunk/src/c/objects/Elements/TriaHook.cpp
r9320 r9356 43 43 /*}}}*/ 44 44 /*FUNCTION TriaHook::TriaHook(int in_numanalyses,int matice_id, int matpar_id){{{1*/ 45 TriaHook::TriaHook(int in_numanalyses,int matice_id, int matpar_id){ 45 TriaHook::TriaHook(int in_numanalyses,int matice_id, IoModel* iomodel){ 46 47 /*intermediary: */ 48 int matpar_id; 49 50 /*retrieve parameters: */ 51 iomodel->parameters->FindParam(&matpar_id,NumberOfElementsEnum); matpar_id++; 46 52 47 53 this->numanalyses=in_numanalyses; -
issm/trunk/src/c/objects/Elements/TriaHook.h
r4396 r9356 7 7 8 8 class Hook; 9 class IoModel; 9 10 10 11 class TriaHook{ … … 19 20 /*FUNCTION constructors, destructors {{{1*/ 20 21 TriaHook(); 21 TriaHook(int in_numanalyses,int matice_id, int matpar_id);22 TriaHook(int in_numanalyses,int matice_id, IoModel* iomodel); 22 23 ~TriaHook(); 23 24 void SetHookNodes(int* node_ids,int analysis_counter); -
issm/trunk/src/c/objects/IoModel.cpp
r9343 r9356 13 13 #include <stdio.h> 14 14 #include "./objects.h" 15 #include "./Container/Parameters.h" 15 16 #include "../shared/shared.h" 16 17 #include "../io/io.h" … … 19 20 /*FUNCTION IoModel::IoModel(){{{1*/ 20 21 IoModel::IoModel(){ 22 this->fid=NULL; 23 this->parameters=NULL; 24 } 25 /*}}}*/ 26 /*FUNCTION IoModel::IoModel(FILE* iomodel_handle){{{1*/ 27 IoModel::IoModel(FILE* iomodel_handle){ 28 29 int i,j; 30 31 /*First, keep track of the file handle: */ 32 this->fid=iomodel_handle; 33 34 /*Initialize and read parameters:*/ 35 this->parameters=new Parameters(); 36 this->FetchParameters(this->parameters); /*this routine goes through the input file, and fetches bools, ints, doubles and strings only, nothing memory intensive*/ 37 38 /*Initialize the structure: */ 21 39 this->IoModelInit(); 40 22 41 } 23 42 /*}}}*/ … … 43 62 xfree((void**)&this->nodeonhutter); 44 63 xfree((void**)&this->nodeonmacayeal); 45 if (this->dim==3){ 46 xfree((void**)&this->elements2d); 47 xfree((void**)&this->upperelements); 48 xfree((void**)&this->lowerelements); 49 xfree((void**)&this->nodeonpattyn); 50 } 64 xfree((void**)&this->elements2d); 65 xfree((void**)&this->upperelements); 66 xfree((void**)&this->lowerelements); 67 xfree((void**)&this->nodeonpattyn); 51 68 xfree((void**)&this->elementonbed); 52 69 xfree((void**)&this->elementonsurface); … … 108 125 109 126 /*!Delete structure fields: */ 110 xfree((void**)&this->inputfilename);111 xfree((void**)&this->outputfilename);112 xfree((void**)&this->repository);113 xfree((void**)&this->name);114 127 xfree((void**)&this->riftinfo); 115 128 xfree((void**)&this->penalties); … … 124 137 } 125 138 /*}}}*/ 126 /*FUNCTION IoModel::IoModel(FILE* iomodel_handle){{{1*/127 IoModel::IoModel(FILE* iomodel_handle){128 129 /*First, keep track of the fil handle: */130 this->fid=iomodel_handle;131 132 int i,j;133 134 /*First, initialize the structure: */135 this->IoModelInit();136 137 /*Get all the data that consists of scalars, integers and strings: */138 139 this->FetchData(&this->name,NameEnum);140 this->FetchData(&this->inputfilename,InputfilenameEnum);141 this->FetchData(&this->outputfilename,OutputfilenameEnum);142 this->FetchData(&this->qmu_analysis,QmuAnalysisEnum);143 this->FetchData(&this->control_analysis,ControlAnalysisEnum);144 this->FetchData(&this->dim,DimEnum);145 /*!Get numberofelements and numberofvertices: */146 this->FetchData(&this->numberofvertices,NumberOfNodesEnum);147 this->FetchData(&this->numberofelements,NumberOfElementsEnum);148 /*!In case we are running 3d, we are going to need the collapsed and non-collapsed 2d meshes, from which the 3d mesh was extruded: */149 if (this->dim==3){150 151 /*!Deal with 2d mesh: */152 this->FetchData(&this->numberofelements2d,NumberOfElements2DEnum);153 this->FetchData(&this->numberofvertices2d,NumberOfNodes2DEnum);154 this->FetchData(&this->numlayers,NumlayersEnum);155 }156 157 158 /*elements type: */159 this->FetchData(&this->ishutter,IshutterEnum);160 this->FetchData(&this->ismacayealpattyn,IsmacayealpattynEnum);161 this->FetchData(&this->isstokes,IsstokesEnum);162 163 /*!Get drag_type, drag and p,q: */164 this->FetchData(&this->drag_type,DragTypeEnum);165 166 /*!Get materials: */167 this->FetchData(&this->rho_water,RhoWaterEnum);168 this->FetchData(&this->rho_ice,RhoIceEnum);169 this->FetchData(&this->g,GEnum);170 171 /*Get control parameters: */172 this->FetchData(&this->num_control_type,NumControlTypeEnum);173 this->FetchData(&this->num_cm_responses,NumCmResponsesEnum);174 175 /*!Get solution parameters: */176 this->FetchData(&this->yts,YtsEnum);177 this->FetchData(&this->meanvel,MeanvelEnum);178 this->FetchData(&this->epsvel,EpsvelEnum);179 this->FetchData(&this->verbose,VerboseBinaryEnum);180 this->FetchData(&this->output_frequency,OutputFrequencyEnum);181 this->FetchData(&this->prognostic_DG,PrognosticDGEnum);182 this->FetchData(&this->nsteps,NstepsEnum);183 this->FetchData(&this->eps_cm,EpsCmEnum);184 this->FetchData(&this->tolx,TolxEnum);185 this->FetchData(&this->cm_gradient,CmGradientEnum);186 this->FetchData(&this->eps_res,EpsResEnum);187 this->FetchData(&this->eps_rel,EpsRelEnum);188 this->FetchData(&this->eps_abs,EpsAbsEnum);189 this->FetchData(&this->max_nonlinear_iterations,MaxNonlinearIterationsEnum);190 this->FetchData(&this->max_steadystate_iterations,MaxSteadystateIterationsEnum);191 this->FetchData(&this->dt,DtEnum);192 this->FetchData(&this->ndt,NdtEnum);193 this->FetchData(&this->time_adapt,TimeAdaptEnum);194 this->FetchData(&this->cfl_coefficient,CflCoefficientEnum);195 this->FetchData(&this->hydrostatic_adjustment,HydrostaticAdjustmentEnum);196 this->FetchData(&this->penalty_offset,PenaltyOffsetEnum);197 this->FetchData(&this->penalty_melting,PenaltyMeltingEnum);198 this->FetchData(&this->penalty_lock,PenaltyLockEnum);199 this->FetchData(&this->sparsity,SparsityEnum);200 this->FetchData(&this->connectivity,ConnectivityEnum);201 this->FetchData(&this->lowmem,LowmemEnum);202 this->FetchData(&this->viscosity_overshoot,ViscosityOvershootEnum);203 this->FetchData(&this->artdiff,ArtificialDiffusivityEnum);204 this->FetchData(&this->prognostic_DG,PrognosticDGEnum);205 this->FetchData(&this->stokesreconditioning,StokesreconditioningEnum);206 this->FetchData(&this->shelf_dampening,ShelfDampeningEnum);207 this->FetchData(&this->waitonlock,WaitonlockEnum);208 this->FetchData(&this->gl_migration,GlMigrationEnum);209 this->FetchData(&this->isdiagnostic,IsdiagnosticEnum);210 this->FetchData(&this->isprognostic,IsprognosticEnum);211 this->FetchData(&this->isthermal,IsthermalEnum);212 213 /*!Get thermal parameters: */214 this->FetchData(&this->beta,BetaEnum);215 this->FetchData(&this->meltingpoint,MeltingpointEnum);216 this->FetchData(&this->referencetemperature,ReferencetemperatureEnum);217 this->FetchData(&this->latentheat,LatentheatEnum);218 this->FetchData(&this->heatcapacity,HeatcapacityEnum);219 this->FetchData(&this->thermalconductivity,ThermalconductivityEnum);220 this->FetchData(&this->min_thermal_constraints,MinThermalConstraintsEnum);221 this->FetchData(&this->min_mechanical_constraints,MinMechanicalConstraintsEnum);222 this->FetchData(&this->stabilize_constraints,StabilizeConstraintsEnum);223 this->FetchData(&this->mixed_layer_capacity,MixedLayerCapacityEnum);224 this->FetchData(&this->thermal_exchange_velocity,ThermalExchangeVelocityEnum);225 this->FetchData(&this->basal_melting_rate_correction_apply,BasalMeltingRateCorrectionApplyEnum);226 this->FetchData(&this->gl_melting_rate,GlMeltingRateEnum);227 this->FetchData(&this->rheology_law,RheologyLawEnum);228 229 /*!Get hydrology parameters: */230 this->FetchData(&this->hydro_kn,HydroKnEnum);231 this->FetchData(&this->hydro_p,HydroPEnum);232 this->FetchData(&this->hydro_q,HydroQEnum);233 this->FetchData(&this->hydro_CR,HydroCREnum);234 this->FetchData(&this->hydro_n,HydroNEnum);235 236 /*qmu: */237 if(this->qmu_analysis){238 this->FetchData(&this->numberofvariables,NumberOfVariablesEnum);239 this->FetchData(&this->numberofresponses,NumberOfResponsesEnum);240 this->FetchData(&this->qmu_npart,NpartEnum);241 this->FetchData(&this->qmu_save_femmodel,QmuSaveFemmodelEnum);242 }243 244 /*i/o: */245 this->FetchData(&this->io_gather,IoGatherEnum);246 }247 /*}}}*/248 139 /*FUNCTION IoModel::IoModelInit{{{1*/ 249 140 void IoModel::IoModelInit(void){ 141 142 /*exterior data: */ 143 this->nodecounter=0; 144 this->loadcounter=0; 145 this->constraintcounter=0; 250 146 251 147 /*!initialize all pointers to 0: */ 252 this->name=NULL;253 this->inputfilename=NULL;254 this->outputfilename=NULL;255 this->repository=NULL;256 this->qmu_analysis=0;257 this->control_analysis=0;258 this->numberofvariables=0;259 this->numvariabledescriptors=0;260 this->numberofresponses=0;261 this->numresponsedescriptors=0;262 this->qmu_npart=0;263 this->numberofelements=0;264 this->numberofvertices=0;265 148 this->x=NULL; 266 149 this->y=NULL; … … 270 153 this->elements_type=NULL; 271 154 this->vertices_type=NULL; 272 this->numberofvertices2d=0;273 155 this->elements2d=NULL; 274 this->numlayers=0;275 156 this->upperelements=NULL; 276 157 this->lowerelements=NULL; … … 278 159 this->nodeonmacayeal=NULL; 279 160 this->nodeonpattyn=NULL; 280 this->io_gather=1;281 161 282 162 this->vx_obs=NULL; … … 289 169 this->temperature=NULL; 290 170 this->waterfraction=NULL; 291 this->gl_melting_rate=0;292 171 this->basal_melting_rate=NULL; 293 172 this->watercolumn=NULL; 294 173 this->basal_melting_rate_correction=NULL; 295 this->basal_melting_rate_correction_apply=0;296 174 this->geothermalflux=NULL; 297 175 this->elementonbed=NULL; … … 313 191 this->nodeonwater=NULL; 314 192 315 this->drag_type=0;316 193 this->drag_coefficient=NULL; 317 194 this->drag_p=NULL; … … 319 196 320 197 321 this->numberofpressureloads=0;322 198 this->pressureload=NULL; 323 199 this-> spcvx=NULL; … … 328 204 this-> spcwatercolumn=NULL; 329 205 this-> diagnostic_ref=NULL; 330 this->numberofedges=0;331 206 this->edges=NULL; 332 207 333 208 /*!materials: */ 334 this->rho_water=0;335 this->rho_ice=0;336 this->g=0;337 209 this->rheology_n=NULL; 338 210 this->rheology_B=NULL; 339 this->rheology_law=0;340 211 341 212 /*!solution parameters: */ … … 344 215 this->weights=NULL; 345 216 this->cm_jump=NULL; 346 this->meanvel=0;347 this->epsvel=0;348 this->nsteps=0;349 this->eps_cm=0;350 this->tolx=0;351 217 this->maxiter=NULL; 352 218 this->cm_min=NULL; 353 219 this->cm_max=NULL; 354 this->cm_gradient=0;355 this->verbose=0;356 this->output_frequency=0;357 this->eps_res=0;358 this->eps_rel=0;359 this->eps_abs=0;360 this->max_nonlinear_iterations=0;361 this->max_steadystate_iterations=0;362 this->dt=0;363 this->ndt=0;364 this->time_adapt=0;365 this->cfl_coefficient=0;366 this->hydrostatic_adjustment=0;367 this->gl_migration=0;368 this->penalty_offset=0;369 this->penalty_melting=0;370 this->penalty_lock=0;371 this->sparsity=0;372 this->connectivity=0;373 this->lowmem=0;374 220 this->optscal=NULL; 375 this->yts=0; 376 this->viscosity_overshoot=0; 377 this->artdiff=0; 378 this->prognostic_DG=0; 379 this->stokesreconditioning=0; 380 this->shelf_dampening=0; 381 this->waitonlock=0; 382 this->isdiagnostic=0; 383 this->isprognostic=0; 384 this->isthermal=0; 385 386 /*!thermal parameters: */ 387 this->beta=0; 388 this->meltingpoint=0; 389 this->referencetemperature=0; 390 this->latentheat=0; 391 this->heatcapacity=0; 392 this->thermalconductivity=0; 393 this->min_thermal_constraints=0; 394 this->min_mechanical_constraints=0; 395 this->stabilize_constraints=0; 396 this->mixed_layer_capacity=0; 397 this->thermal_exchange_velocity=0; 398 399 400 this->numrifts=0; 221 401 222 this->riftinfo=NULL; 402 223 403 224 /*!penalties: */ 404 this->numpenalties=0;405 225 this->penalties=NULL; 406 226 … … 410 230 this->surface_ablation_rate=NULL; 411 231 this->dhdt=NULL; 412 413 /*elements type: */414 this->ishutter=0;415 this->ismacayealpattyn=0;416 this->isstokes=0;417 232 418 233 /*exterior data: */ … … 422 237 this->singlenodetoelementconnectivity=NULL; 423 238 this->numbernodetoelementconnectivity=NULL; 424 this->nodecounter=0;425 this->loadcounter=0;426 this->constraintcounter=0;427 239 } 428 240 /*}}}*/ … … 435 247 436 248 /*output: */ 437 bool boolean;249 int booleanint; 438 250 int code; 439 251 440 252 /*Set file pointer to beginning of the data: */ 441 253 fid=this->SetFilePointerToData(&code,NULL,data_enum); 442 254 443 255 if(code!=1)_error_("%s%s","IoModel::FetchData expecting a boolean for enum ",EnumToStringx(data_enum)); 444 256 445 257 /*We have to read a boolean from disk. */ 446 258 if(my_rank==0){ 447 if(fread(&boolean ,sizeof(bool),1,fid)!=1) _error_(" could not read boolean ");448 } 449 450 MPI_Bcast(&boolean,1,MPI_BYTE,0,MPI_COMM_WORLD); 451 259 if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_(" could not read boolean "); 260 } 261 MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD); 262 263 /*cast to bool: */ 452 264 /*Assign output pointers: */ 453 *pboolean= boolean;265 *pboolean=(bool)booleanint; 454 266 455 267 } … … 558 370 } 559 371 /*}}}*/ 560 /*FUNCTION IoModel::FetchData( double** pdoublematrix,int* pM,int* pN,int data_enum){{{1*/561 void IoModel::FetchData( double** pmatrix,int* pM,int* pN,int data_enum){372 /*FUNCTION IoModel::FetchData(int** pintegerematrix,int* pM,int* pN,int data_enum){{{1*/ 373 void IoModel::FetchData(int** pmatrix,int* pM,int* pN,int data_enum){ 562 374 563 375 extern int my_rank; 564 376 extern int num_procs; 377 int i,j; 565 378 566 379 /*output: */ 567 380 int M,N; 568 381 double* matrix=NULL; 382 int* integer_matrix=NULL; 569 383 int code=0; 570 384 int vector_type=0; 571 572 385 573 386 … … 604 417 } 605 418 419 /*Now cast to integer: */ 420 if(M*N){ 421 integer_matrix=(int*)xmalloc(M*N*sizeof(int)); 422 for (i=0;i<M;i++){ 423 for (j=0;j<N;j++){ 424 integer_matrix[i*N+j]=(int)matrix[i*N+j]; 425 } 426 } 427 } 428 else{ 429 integer_matrix=NULL; 430 } 431 /*Free ressources:*/ 432 xfree((void**)&matrix); 433 434 /*Assign output pointers: */ 435 *pmatrix=integer_matrix; 436 if (pM)*pM=M; 437 if (pN)*pN=N; 438 439 } 440 /*}}}*/ 441 /*FUNCTION IoModel::FetchData(double** pdoublematrix,int* pM,int* pN,int data_enum){{{1*/ 442 void IoModel::FetchData(double** pmatrix,int* pM,int* pN,int data_enum){ 443 444 extern int my_rank; 445 extern int num_procs; 446 447 /*output: */ 448 int M,N; 449 double* matrix=NULL; 450 int code=0; 451 int vector_type=0; 452 453 454 455 /*Set file pointer to beginning of the data: */ 456 fid=this->SetFilePointerToData(&code,&vector_type,data_enum); 457 458 if((code!=5) && (code!=6) && (code!=7))_error_("%s%s","IoModel::FetchData expecting a double, integer or boolean matrix for enum ",EnumToStringx(data_enum)); 459 460 /*Now fetch: */ 461 462 /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */ 463 /*numberofelements: */ 464 if(my_rank==0){ 465 if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix "); 466 } 467 468 MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD); 469 470 if(my_rank==0){ 471 if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix "); 472 } 473 MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD); 474 475 /*Now allocate matrix: */ 476 if(M*N){ 477 matrix=(double*)xmalloc(M*N*sizeof(double)); 478 479 /*Read matrix on node 0, then broadcast: */ 480 if(my_rank==0){ 481 if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix "); 482 } 483 484 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD); 485 } 486 606 487 /*Assign output pointers: */ 607 488 *pmatrix=matrix; … … 757 638 *pndims=ndims; 758 639 *pnumrecords=numrecords; 640 } 641 /*}}}*/ 642 /*FUNCTION IoModel::FetchParameters(Parameters* parameters){{{1*/ 643 void IoModel::FetchParameters(Parameters* parameters){ 644 645 extern int my_rank; 646 extern int num_procs; 647 648 /*record descriptions; */ 649 int record_enum; 650 int record_length; 651 int record_code; //1 to 7 number 652 653 /*records: */ 654 int booleanint=0; 655 int integer=0; 656 double scalar=0; 657 char* string=NULL; 658 int string_size; 659 660 661 /*Go find in the binary file, the position of the data we want to fetch: */ 662 if(my_rank==0){ //cpu 0{{{2 663 664 /*First set FILE* position to the beginning of the file: */ 665 fseek(this->fid,0,SEEK_SET); 666 667 /*Now march through file looking for the correct data identifiers (bool,int,double or string): */ 668 for(;;){ 669 if(fread(&record_enum,sizeof(int),1,this->fid)==0){ 670 671 /*Ok, we have reached the end of the file. break: */ 672 record_code=0; //0 means bailout 673 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); /*tell others cpus we are bailing: */ 674 break; 675 } 676 else{ 677 678 /* Read the record length and the data type code: */ 679 fread(&record_length,sizeof(int),1,this->fid); 680 fread(&record_code,sizeof(int),1,this->fid); 681 682 /*Tell other cpus what we are doing: */ 683 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); /*tell other cpus what we are going to do: */ 684 685 /*Tell other cpus the name of the data, then branch according to the data type: */ 686 MPI_Bcast(&record_enum,1,MPI_INT,0,MPI_COMM_WORLD); 687 MPI_Bcast(&record_length,1,MPI_INT,0,MPI_COMM_WORLD); 688 689 690 switch(record_code){ 691 case 1: 692 /*Read the boolean and broadcast it to other cpus:*/ 693 if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error_(" could not read boolean "); 694 MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD); 695 696 /*create BoolParam: */ 697 parameters->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to boolean 698 699 break; 700 case 2: 701 /*Read the integer and broadcast it to other cpus:*/ 702 if(fread(&integer,sizeof(int),1,this->fid)!=1) _error_(" could not read integer "); 703 MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD); 704 705 /*create IntParam: */ 706 parameters->AddObject(new IntParam(record_enum,integer)); 707 708 break; 709 case 3: 710 /*Read the scalar and broadcast it to other cpus:*/ 711 if(fread(&scalar,sizeof(double),1,this->fid)!=1) _error_(" could not read scalar "); 712 MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD); 713 714 /*create DoubleParam: */ 715 parameters->AddObject(new DoubleParam(record_enum,scalar)); 716 717 break; 718 case 4: 719 /*We have to read a string from disk. First read the dimensions of the string, then the string: */ 720 if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error_(" could not read length of string "); 721 MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD); 722 723 if(string_size){ 724 string=(char*)xmalloc((string_size+1)*sizeof(char)); 725 string[string_size]='\0'; 726 727 /*Read string, then broadcast: */ 728 if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error_(" could not read string "); 729 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD); 730 } 731 else{ 732 string=(char*)xmalloc(sizeof(char)); 733 string[0]='\0'; 734 } 735 736 /*Add string to parameters: */ 737 parameters->AddObject(new StringParam(record_enum,string)); 738 739 break; 740 case 5: 741 /*We are not interested in this record, too memory intensive. Skip it: */ 742 /*skip: */ 743 fseek(fid,-sizeof(int),SEEK_CUR); //backtrak 1 integer 744 fseek(fid,record_length,SEEK_CUR); 745 break; 746 case 6: 747 /*We are not interested in this record, too memory intensive. Skip it: */ 748 /*skip: */ 749 fseek(fid,-sizeof(int),SEEK_CUR); //backtrak 1 integer 750 fseek(fid,record_length,SEEK_CUR); 751 break; 752 case 7: 753 /*We are not interested in this record, too memory intensive. Skip it: */ 754 /*skip: */ 755 fseek(fid,-sizeof(int),SEEK_CUR); //backtrak 1 integer 756 fseek(fid,record_length,SEEK_CUR); 757 break; 758 759 case 8: 760 /*We are not interested in this record, too memory intensive. Skip it: */ 761 /*skip: */ 762 fseek(fid,-sizeof(int),SEEK_CUR); //backtrak 1 integer 763 fseek(fid,record_length,SEEK_CUR); 764 break; 765 766 case 9: 767 /*We are not interested in this record, too memory intensive. Skip it: */ 768 /*skip: */ 769 fseek(fid,-sizeof(int),SEEK_CUR); //backtrak 1 integer 770 fseek(fid,record_length,SEEK_CUR); 771 break; 772 773 default: 774 _error_("%s%i","unknown record type:",record_code); 775 break;; 776 } 777 } 778 } 779 } //}}} 780 else{ //cpu ~0 {{{2 781 for(;;){ //wait on cpu 0 782 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); /*get from cpu 0 what we are going to do: */ 783 if(record_code==0){ 784 break; //we are done, break from the loop 785 } 786 else{ 787 MPI_Bcast(&record_enum,1,MPI_INT,0,MPI_COMM_WORLD); //get from cpu 0 name of the data 788 MPI_Bcast(&record_length,1,MPI_INT,0,MPI_COMM_WORLD); 789 switch(record_code){ 790 case 1: 791 /*boolean. get it from cpu 0 */ 792 MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD); 793 794 /*create BoolParam: */ 795 parameters->AddObject(new BoolParam(record_enum,(bool)booleanint)); //cast to a boolean 796 break; 797 798 case 2: 799 /*integer. get it from cpu 0 */ 800 MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD); 801 802 /*create IntParam: */ 803 parameters->AddObject(new IntParam(record_enum,integer)); 804 805 break; 806 case 3: 807 /*scalar. get it from cpu 0 */ 808 MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD); 809 810 /*create DoubleParam: */ 811 parameters->AddObject(new DoubleParam(record_enum,scalar)); 812 813 break; 814 case 4: 815 MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD); 816 if(string_size){ 817 string=(char*)xmalloc((string_size+1)*sizeof(char)); 818 string[string_size]='\0'; 819 820 /*Read string from cpu 0: */ 821 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD); 822 } 823 else{ 824 string=(char*)xmalloc(sizeof(char)); 825 string[0]='\0'; 826 } 827 /*Add string to parameters: */ 828 parameters->AddObject(new StringParam(record_enum,string)); 829 830 break; 831 case 5: break; //do nothing. not interested in this type of data, which is memory intensive. 832 case 6: break; //do nothing. not interested in this type of data, which is memory intensive. 833 case 7: break; //do nothing. not interested in this type of data, which is memory intensive. 834 case 8: break; //do nothing. not interested in this type of data, which is memory intensive. 835 case 9: break; //do nothing. not interested in this type of data, which is memory intensive. 836 837 default: 838 _error_("%s%i","unknown record type:",record_code); 839 break;; 840 } 841 842 843 } 844 } 845 } //}}} 759 846 } 760 847 /*}}}*/ … … 821 908 } 822 909 /*}}}*/ 823 /*FUNCTION IoModel::Echo{{{1*/824 void IoModel::Echo(int which_part,int rank) {825 826 //which_part determines what gets echoed, otherwise, we'll get too much output.827 //1-> penalties828 829 int i,j;830 831 if(which_part==1 && my_rank==rank && this->dim==3){832 printf("IoModel penalties: \n");833 printf(" number of penalties: %i\n",this->numpenalties);834 printf(" nodes: \n");835 836 for(i=0;i<this->numpenalties;i++){837 for(j=0;j<this->numlayers;j++){838 printf("%i ",(int)*(this->penalties+this->numlayers*i+j));839 }840 printf("\n");841 }842 }843 }844 /*}}}*/845 910 /*FUNCTION IoModel::FetchDataToInput(Elements* elements,IoModel* iomodel,int vector_enum,int default_vector_enum,double default_value{{{1*/ 846 911 void IoModel::FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum,double default_value){ … … 858 923 int nods; 859 924 int nel; 925 int numberofelements; 860 926 861 927 … … 868 934 int M,N; 869 935 936 /*Fetch parameters: */ 937 this->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 938 870 939 /*First of, find the record for the enum, and get code of data type: */ 871 940 fid=this->SetFilePointerToData(&code, &vector_layout,vector_enum); … … 877 946 /*Add boolean constant input to all elements: */ 878 947 counter=0; 879 for (i=0;i< this->numberofelements;i++){948 for (i=0;i<numberofelements;i++){ 880 949 if(this->my_elements[i]){ 881 950 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 890 959 /*Add integer constant input to all elements: */ 891 960 counter=0; 892 for (i=0;i< this->numberofelements;i++){961 for (i=0;i<numberofelements;i++){ 893 962 if(this->my_elements[i]){ 894 963 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 903 972 /*Add double constant input to all elements: */ 904 973 counter=0; 905 for (i=0;i< this->numberofelements;i++){974 for (i=0;i<numberofelements;i++){ 906 975 if(this->my_elements[i]){ 907 976 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 940 1009 /*Create inputs:*/ 941 1010 counter=0; 942 for (i=0;i< this->numberofelements;i++){1011 for (i=0;i<numberofelements;i++){ 943 1012 if(this->my_elements[i]){ 944 1013 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 978 1047 /*Create inputs:*/ 979 1048 counter=0; 980 for (i=0;i< this->numberofelements;i++){1049 for (i=0;i<numberofelements;i++){ 981 1050 if(this->my_elements[i]){ 982 1051 Element* element=(Element*)elements->GetObjectByOffset(counter); … … 1016 1085 /*Create inputs:*/ 1017 1086 counter=0; 1018 for (i=0;i< this->numberofelements;i++){1087 for (i=0;i<numberofelements;i++){ 1019 1088 if(this->my_elements[i]){ 1020 1089 Element* element=(Element*)elements->GetObjectByOffset(counter); -
issm/trunk/src/c/objects/IoModel.h
r9343 r9356 16 16 private: 17 17 FILE* fid; //pointer to input file 18 18 19 public: 20 Parameters* parameters; //this dataset holds all double, int, bool and char* parameters read in from the input file.* 19 21 /*Data: {{{1*/ 20 char* name; 21 char* inputfilename; 22 char* outputfilename; 23 char* repository; 24 int dim; 25 int qmu_analysis; 26 int control_analysis; 22 23 int nodecounter; //keep track of how many nodes are being created in each analysis type 24 int loadcounter; //keep track of how many loads are being created in each analysis type 25 int constraintcounter; //keep track of how many constraints are being created in each analysis type 27 26 28 27 /*2d mesh: */ 29 int numberofelements;30 int numberofvertices;31 28 double* x; 32 29 double* y; … … 38 35 39 36 /*3d mesh: */ 40 int numberofvertices2d;41 int numberofelements2d;42 37 double* elements2d; 43 int numlayers;44 38 double* upperelements; 45 39 double* lowerelements; 46 40 47 41 /*elements type: */ 48 int ishutter;49 int ismacayealpattyn;50 int isstokes;51 42 double* nodeonhutter; 52 43 double* nodeonmacayeal; … … 61 52 double* waterfraction; 62 53 63 /*i/o: */64 int io_gather;65 66 54 /*observations: */ 67 55 double* thickness_obs; … … 69 57 double* vy_obs; 70 58 double* vz_obs; 71 72 /*qmu: */73 int numberofvariables;74 int numvariabledescriptors;75 int numberofresponses;76 int numresponsedescriptors;77 int qmu_npart;78 59 79 60 /*geometry: */ … … 96 77 97 78 /*friction: */ 98 int drag_type;99 79 double* drag_coefficient; 100 80 double* drag_p; … … 102 82 103 83 /*boundary conditions: */ 104 int numberofpressureloads;105 84 double* pressureload; 106 85 double* spcvx; … … 112 91 double* diagnostic_ref; 113 92 double* geothermalflux; 114 int numberofedges;115 93 double* edges; 116 94 117 95 /*materials: */ 118 double rho_water,rho_ice;119 double g;120 96 double* rheology_B; 121 97 double* rheology_n; 122 int rheology_law;123 98 124 99 /*numerical parameters: */ 125 double meanvel;126 double epsvel;127 int artdiff;128 int prognostic_DG;129 double viscosity_overshoot;130 double stokesreconditioning;131 int shelf_dampening;132 100 double* cm_min; 133 101 double* cm_max; 134 int cm_gradient;;135 102 136 103 /*control methods: */ 137 int num_cm_responses;138 int num_control_type;139 104 double* control_type; 140 105 … … 143 108 double* weights; 144 109 double* cm_jump; 145 int nsteps;146 double eps_cm;147 double tolx;148 110 double* maxiter; 149 int verbose;150 int output_frequency;151 double eps_res;152 double eps_rel;153 double eps_abs;154 double max_nonlinear_iterations;155 double max_steadystate_iterations;156 double dt,ndt;157 int time_adapt;158 double cfl_coefficient;159 int hydrostatic_adjustment;160 double penalty_offset;161 double penalty_melting;162 int penalty_lock;163 double sparsity;164 int connectivity;165 int lowmem;166 111 double* optscal; 167 double yts;168 double waitonlock;169 int isdiagnostic;170 int isprognostic;171 int isthermal;172 173 /*thermal parameters: */174 double beta;175 double meltingpoint;176 double referencetemperature;177 double latentheat;178 double heatcapacity,thermalconductivity;179 int min_thermal_constraints;180 int min_mechanical_constraints;181 int stabilize_constraints;182 double mixed_layer_capacity;183 double thermal_exchange_velocity;184 112 185 113 /*rifts: */ 186 int numrifts;187 114 double* riftinfo; 188 115 189 116 /*penalties: */ 190 int numpenalties;191 117 double* penalties; 192 118 … … 194 120 double* basal_melting_rate; 195 121 double* watercolumn; 196 double gl_melting_rate;197 122 double* basal_melting_rate_correction; 198 int basal_melting_rate_correction_apply;199 123 double* surface_mass_balance; 200 124 double* surface_accumulation_rate; … … 202 126 203 127 double* dhdt; 204 205 /*qmu: */206 int qmu_save_femmodel;207 208 /*grounding line migration: */209 int gl_migration;210 128 211 129 /*exterior partitioning data, to be carried around: */ … … 215 133 int* singlenodetoelementconnectivity; 216 134 int* numbernodetoelementconnectivity; 217 int nodecounter; //keep track of how many nodes are being created in each analysis type218 int loadcounter; //keep track of how many loads are being created in each analysis type219 int constraintcounter; //keep track of how many constraints are being created in each analysis type220 135 221 /*hydrology parameters: */222 double hydro_kn;223 double hydro_p;224 double hydro_q;225 double hydro_CR;226 double hydro_n;227 136 /*}}}*/ 228 137 /*Methods: {{{1*/ … … 231 140 IoModel(FILE* iomodel_handle); 232 141 void IoModelInit(void); 233 void Echo(int which_part,int rank);234 142 /*}}}*/ 235 143 /*Input/Output:{{{1*/ … … 238 146 void FetchData(double* pscalar,int data_enum); 239 147 void FetchData(char** pstring,int data_enum); 148 void FetchData(int** pmatrix,int* pM,int* pN,int data_enum); 240 149 void FetchData(double** pscalarmatrix,int* pM,int* pN,int data_enum); 241 150 void FetchData(char*** pstringarray,int* pnumstrings,int data_enum); 242 151 void FetchData(double*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum); 152 void FetchParameters(Parameters* parameters); 243 153 FILE* SetFilePointerToData(int* pcode,int* pvector_type, int data_enum); 244 154 void FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,double default_value=0); -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r9320 r9356 43 43 int segment_width; 44 44 int element; 45 int num_nodes; 45 int num_nodes; 46 int dim; 47 int numberofelements; 46 48 47 49 /*icefront constructor data: */ … … 50 52 int icefront_node_ids[NUMVERTICESQUA]; //initialize with largest size 51 53 int icefront_fill; 54 55 /*find parameters: */ 56 iomodel->parameters->FindParam(&dim,DimEnum); 57 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 52 58 53 59 /*First, retrieve element index and element type: */ 54 if ( iomodel->dim==2){60 if (dim==2){ 55 61 segment_width=4; 56 62 } … … 62 68 /*Build ids for hook constructors: */ 63 69 icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing 64 icefront_mparid= iomodel->numberofelements+1; //matlab indexing70 icefront_mparid=numberofelements+1; //matlab indexing 65 71 66 72 if (in_icefront_type==MacAyeal2dIceFrontEnum || in_icefront_type==MacAyeal3dIceFrontEnum){ -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r9320 r9356 51 51 int numericalflux_type; 52 52 53 int numberofelements; 54 55 /*Fetch parameters: */ 56 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 57 53 58 /* Get MatPar id */ 54 numericalflux_mparid= iomodel->numberofelements+1; //matlab indexing59 numericalflux_mparid=numberofelements+1; //matlab indexing 55 60 56 61 /*First, see wether this is an internal or boundary edge (if e2=NaN)*/ -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r9320 r9356 49 49 int pengrid_element_id; 50 50 51 int numberofvertices; 52 int numberofelements; 53 54 /*Fetch parameters: */ 55 iomodel->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); 56 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 57 51 58 /*Some checks if debugging activated*/ 52 59 _assert_(iomodel->singlenodetoelementconnectivity); 53 _assert_(index>=0 && index< iomodel->numberofvertices);60 _assert_(index>=0 && index<numberofvertices); 54 61 _assert_(id); 55 62 … … 62 69 pengrid_element_id=iomodel->singlenodetoelementconnectivity[index]; 63 70 _assert_(pengrid_element_id); 64 pengrid_matpar_id= iomodel->numberofelements+1; //refers to the constant material parameters object71 pengrid_matpar_id=numberofelements+1; //refers to the constant material parameters object 65 72 66 73 this->hnode=new Hook(&pengrid_node_id,1); -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r9320 r9356 48 48 double riftfront_fractionincrement; 49 49 bool riftfront_shelf; 50 int numberofelements; 51 int penalty_lock; 50 52 51 53 /*intermediary: */ 52 54 int el1 ,el2; 53 55 int node1 ,node2; 56 57 /*Fetch parameters: */ 58 iomodel->parameters->FindParam(&numberofelements,NumberOfElementsEnum); 59 iomodel->parameters->FindParam(&penalty_lock,PenaltyLockEnum); 54 60 55 61 /*Ok, retrieve all the data needed to add a penalty between the two nodes: */ … … 69 75 riftfront_elem_ids[0]=el1; 70 76 riftfront_elem_ids[1]=el2; 71 riftfront_matpar_id= iomodel->numberofelements+1; //matlab indexing77 riftfront_matpar_id=numberofelements+1; //matlab indexing 72 78 73 79 /*Hooks: */ … … 81 87 this->counter=0; 82 88 this->prestable=0; 83 this->penalty_lock= iomodel->penalty_lock;89 this->penalty_lock=penalty_lock; 84 90 this->material_converged=0; 85 91 this->normal[0]=*(iomodel->riftinfo+RIFTINFOSIZE*i+4); -
issm/trunk/src/c/objects/Materials/Matice.cpp
r9320 r9356 655 655 int i,j; 656 656 657 int dim; 658 int control_analysis; 659 int num_control_type; 660 661 /*Fetch parameters: */ 662 iomodel->parameters->FindParam(&dim,DimEnum); 663 iomodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum); 664 iomodel->parameters->FindParam(&num_control_type,NumControlTypeEnum); 665 666 657 667 /*if 2d*/ 658 if( iomodel->dim==2){668 if(dim==2){ 659 669 660 670 /*Intermediaries*/ … … 677 687 678 688 /*Control Inputs*/ 679 if ( iomodel->control_analysis && iomodel->control_type){680 for(i=0;i< iomodel->num_control_type;i++){689 if (control_analysis && iomodel->control_type){ 690 for(i=0;i<num_control_type;i++){ 681 691 switch((int)iomodel->control_type[i]){ 682 692 case RheologyBbarEnum: … … 684 694 _assert_(iomodel->rheology_B);_assert_(iomodel->cm_min); _assert_(iomodel->cm_max); 685 695 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->rheology_B[int(iomodel->elements[num_vertices*index+j]-1)]; 686 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->cm_min[int(iomodel->elements[num_vertices*index+j]-1)* iomodel->num_control_type+i];687 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->cm_max[int(iomodel->elements[num_vertices*index+j]-1)* iomodel->num_control_type+i];696 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->cm_min[int(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i]; 697 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->cm_max[int(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i]; 688 698 this->inputs->AddInput(new ControlInput(RheologyBbarEnum,TriaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 689 699 } … … 695 705 696 706 /*if 3d*/ 697 else if( iomodel->dim==3){707 else if(dim==3){ 698 708 699 709 /*Intermediaries*/ … … 716 726 717 727 /*Control Inputs*/ 718 if ( iomodel->control_analysis && iomodel->control_type){719 for(i=0;i< iomodel->num_control_type;i++){728 if (control_analysis && iomodel->control_type){ 729 for(i=0;i<num_control_type;i++){ 720 730 switch((int)iomodel->control_type[i]){ 721 731 case RheologyBbarEnum: … … 723 733 _assert_(iomodel->rheology_B);_assert_(iomodel->cm_min); _assert_(iomodel->cm_max); 724 734 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->rheology_B[int(iomodel->elements[num_vertices*index+j]-1)]; 725 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->cm_min[int(iomodel->elements[num_vertices*index+j]-1)* iomodel->num_control_type+i];726 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->cm_max[int(iomodel->elements[num_vertices*index+j]-1)* iomodel->num_control_type+i];735 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->cm_min[int(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i]; 736 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->cm_max[int(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i]; 727 737 this->inputs->AddInput(new ControlInput(RheologyBEnum,PentaVertexInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 728 738 } -
issm/trunk/src/c/objects/Materials/Matpar.cpp
r9320 r9356 26 26 27 27 this->mid = matpar_mid; 28 this->rho_ice = iomodel->rho_ice;29 this->rho_water = iomodel->rho_water;30 this->heatcapacity = iomodel->heatcapacity;31 this->thermalconductivity = iomodel->thermalconductivity;32 this->latentheat = iomodel->latentheat;33 this->beta = iomodel->beta;34 this->meltingpoint = iomodel->meltingpoint;35 this->referencetemperature = iomodel->referencetemperature;36 this->mixed_layer_capacity = iomodel->mixed_layer_capacity;37 this->thermal_exchange_velocity = iomodel->thermal_exchange_velocity;38 this->g = iomodel->g;39 40 this->kn = iomodel->hydro_kn;41 this->hydro_p = iomodel->hydro_p;42 this->hydro_q = iomodel->hydro_q;43 this->hydro_CR = iomodel->hydro_CR;44 this->hydro_n = iomodel->hydro_n;28 iomodel->parameters->FindParam(&this->rho_ice,RhoIceEnum); 29 iomodel->parameters->FindParam(&this->rho_water,RhoWaterEnum); 30 iomodel->parameters->FindParam(&this->heatcapacity,HeatcapacityEnum); 31 iomodel->parameters->FindParam(&this->thermalconductivity,ThermalconductivityEnum); 32 iomodel->parameters->FindParam(&this->latentheat,LatentheatEnum); 33 iomodel->parameters->FindParam(&this->beta,BetaEnum); 34 iomodel->parameters->FindParam(&this->meltingpoint,MeltingpointEnum); 35 iomodel->parameters->FindParam(&this->referencetemperature,ReferencetemperatureEnum); 36 iomodel->parameters->FindParam(&this->mixed_layer_capacity,MixedLayerCapacityEnum); 37 iomodel->parameters->FindParam(&this->thermal_exchange_velocity,ThermalExchangeVelocityEnum); 38 iomodel->parameters->FindParam(&this->g,GEnum); 39 40 iomodel->parameters->FindParam(&this->kn,HydroKnEnum); 41 iomodel->parameters->FindParam(&this->hydro_p,HydroPEnum); 42 iomodel->parameters->FindParam(&this->hydro_q,HydroQEnum); 43 iomodel->parameters->FindParam(&this->hydro_CR,HydroCREnum); 44 iomodel->parameters->FindParam(&this->hydro_n,HydroNEnum); 45 45 } 46 46 /*}}}1*/ -
issm/trunk/src/c/objects/Node.cpp
r9320 r9356 34 34 int k,l; 35 35 int gsize; 36 int dim; 37 38 /*Fetch parameters: */ 39 iomodel->parameters->FindParam(&dim,DimEnum); 36 40 37 41 /*id: */ … … 69 73 /*Diagnostic Horiz*/ 70 74 if (analysis_type==DiagnosticHorizAnalysisEnum){ 71 if ( iomodel->dim==3){75 if (dim==3){ 72 76 /*We have a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */ 73 77 if (!iomodel->nodeonbed) _error_("iomodel->nodeonbed is NULL"); … … 116 120 analysis_type==BalancethicknessAnalysisEnum 117 121 ){ 118 if ( iomodel->dim==3){122 if (dim==3){ 119 123 /*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */ 120 124 _assert_(iomodel->nodeonbed); -
issm/trunk/src/c/objects/Params/BoolParam.cpp
r9320 r9356 141 141 #endif 142 142 /*}}}*/ 143 /*FUNCTION BoolParam::UnitConversion{{{1*/ 144 void BoolParam::UnitConversion(int direction_enum){ 145 /*do nothing, no unit conversion*/ 146 } 147 /*}}}*/ -
issm/trunk/src/c/objects/Params/BoolParam.h
r9320 r9356 76 76 void SetValue(FILE* fid){_error_("Bool param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 77 77 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("Bool param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 78 void UnitConversion(int direction_enum); 78 79 79 80 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/DoubleMatArrayParam.cpp
r9320 r9356 384 384 } 385 385 /*}}}*/ 386 /*FUNCTION DoubleMatArrayParam::UnitConversion{{{1*/ 387 void DoubleMatArrayParam::UnitConversion(int direction_enum){ 388 /*go through all matrices and convert: */ 389 for (int i=0;i<this->M;i++){ 390 double* matrix=this->array[i]; 391 int m=this->mdim_array[i]; 392 int n=this->ndim_array[i]; 393 ::UnitConversion(matrix,m*n,direction_enum,this->enum_type); 394 } 395 396 } 397 /*}}}*/ -
issm/trunk/src/c/objects/Params/DoubleMatArrayParam.h
r9320 r9356 79 79 void SetValue(FILE* fid){_error_("Bool param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 80 80 void SetValue(double** array, int M, int* mdim_array, int* ndim_array); 81 void UnitConversion(int direction_enum); 81 82 82 83 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/DoubleMatParam.cpp
r9320 r9356 224 224 } 225 225 /*}}}*/ 226 /*FUNCTION DoubleMatParam::UnitConversion{{{1*/ 227 void DoubleMatParam::UnitConversion(int direction_enum){ 228 ::UnitConversion(this->value,this->M*this->N,direction_enum,this->enum_type); 229 } 230 /*}}}*/ -
issm/trunk/src/c/objects/Params/DoubleMatParam.h
r9320 r9356 78 78 void SetValue(FILE* fid){_error_("DoubleMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 79 79 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("DoubleMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 80 void UnitConversion(int direction_enum); 80 81 81 82 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/DoubleParam.cpp
r9320 r9356 227 227 #endif 228 228 /*}}}*/ 229 /*FUNCTION DoubleParam::UnitConversion{{{1*/ 230 void DoubleParam::UnitConversion(int direction_enum){ 231 ::UnitConversion(&this->value,1,direction_enum,this->enum_type); 232 } 233 /*}}}*/ -
issm/trunk/src/c/objects/Params/DoubleParam.h
r9320 r9356 77 77 void SetValue(FILE* fid){_error_("Double param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 78 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("Double param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 79 void UnitConversion(int direction_enum); 79 80 80 81 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/DoubleVecParam.cpp
r9320 r9356 215 215 } 216 216 /*}}}*/ 217 /*FUNCTION DoubleVecParam::UnitConversion{{{1*/ 218 void DoubleVecParam::UnitConversion(int direction_enum){ 219 ::UnitConversion(this->values,this->M,direction_enum,this->enum_type); 220 } 221 /*}}}*/ -
issm/trunk/src/c/objects/Params/DoubleVecParam.h
r9320 r9356 77 77 void SetValue(FILE* fid){_error_("DoubleVec param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 78 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("DoubleVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 79 void UnitConversion(int direction_enum); 79 80 80 81 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/FileParam.cpp
r9320 r9356 107 107 #endif 108 108 /*}}}*/ 109 /*FUNCTION FileParam::UnitConversion{{{1*/ 110 void FileParam::UnitConversion(int direction_enum){ 111 /*do nothing, no unit conversion*/ 112 } 113 /*}}}*/ -
issm/trunk/src/c/objects/Params/FileParam.h
r9320 r9356 76 76 void SetValue(FILE* fid){_error_("File param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 77 77 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("File param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 78 void UnitConversion(int direction_enum); 78 79 79 80 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/IntMatParam.cpp
r9320 r9356 212 212 } 213 213 /*}}}*/ 214 /*FUNCTION IntMatParam::UnitConversion{{{1*/ 215 void IntMatParam::UnitConversion(int direction_enum){ 216 /*do nothing, no unit conversion*/ 217 } 218 /*}}}*/ -
issm/trunk/src/c/objects/Params/IntMatParam.h
r9320 r9356 78 78 void SetValue(FILE* fid){_error_("IntMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 79 79 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("IntMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 80 void UnitConversion(int direction_enum); 80 81 81 82 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/IntParam.cpp
r9320 r9356 142 142 #endif 143 143 /*}}}*/ 144 /*FUNCTION IntParam::UnitConversion{{{1*/ 145 void IntParam::UnitConversion(int direction_enum){ 146 /*do nothing, no unit conversion*/ 147 } 148 /*}}}*/ -
issm/trunk/src/c/objects/Params/IntParam.h
r9320 r9356 77 77 void SetValue(FILE* fid){_error_("Int param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 78 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("Int param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 79 void UnitConversion(int direction_enum); 79 80 80 81 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/IntVecParam.cpp
r9320 r9356 227 227 } 228 228 /*}}}*/ 229 /*FUNCTION IntVecParam::UnitConversion{{{1*/ 230 void IntVecParam::UnitConversion(int direction_enum){ 231 /*do nothing, no unit conversion*/ 232 } 233 /*}}}*/ -
issm/trunk/src/c/objects/Params/IntVecParam.h
r9320 r9356 78 78 void SetValue(FILE* fid){_error_("IntVec param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 79 79 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("IntVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 80 void UnitConversion(int direction_enum); 80 81 81 82 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/Param.h
r9320 r9356 58 58 virtual void SetValue(FILE* fid)=0; 59 59 virtual void SetValue(double** array, int M, int* mdim_array, int* ndim_array)=0; 60 virtual void UnitConversion(int direction_enum)=0; 60 61 61 62 virtual char* GetParameterName(void)=0; -
issm/trunk/src/c/objects/Params/PetscMatParam.cpp
r9320 r9356 234 234 } 235 235 /*}}}*/ 236 /*FUNCTION PetscMatParam::UnitConversion{{{1*/ 237 void PetscMatParam::UnitConversion(int direction_enum){ 238 /*do nothing, no unit conversion*/ 239 } 240 /*}}}*/ -
issm/trunk/src/c/objects/Params/PetscMatParam.h
r9320 r9356 77 77 void SetValue(FILE* fid){_error_("PetscMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 78 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("PetscMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 79 void UnitConversion(int direction_enum); 79 80 80 81 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/PetscVecParam.cpp
r9320 r9356 229 229 } 230 230 /*}}}*/ 231 /*FUNCTION PetscVecParam::UnitConversion{{{1*/ 232 void PetscVecParam::UnitConversion(int direction_enum){ 233 /*do nothing, no unit conversion*/ 234 } 235 /*}}}*/ -
issm/trunk/src/c/objects/Params/PetscVecParam.h
r9320 r9356 77 77 void SetValue(FILE* fid){_error_("PetscVec of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 78 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("PetscVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 79 void UnitConversion(int direction_enum); 79 80 80 81 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/StringArrayParam.cpp
r9320 r9356 285 285 } 286 286 /*}}}*/ 287 /*FUNCTION StringArrayParam::UnitConversion{{{1*/ 288 void StringArrayParam::UnitConversion(int direction_enum){ 289 /*do nothing, no unit conversion*/ 290 } 291 /*}}}*/ -
issm/trunk/src/c/objects/Params/StringArrayParam.h
r9320 r9356 79 79 void SetValue(FILE* fid){_error_("StringArray param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 80 80 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("StringArray param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 81 void UnitConversion(int direction_enum); 81 82 82 83 char* GetParameterName(void); -
issm/trunk/src/c/objects/Params/StringParam.cpp
r9336 r9356 188 188 } 189 189 /*}}}*/ 190 /*FUNCTION StringParam::UnitConversion{{{1*/ 191 void StringParam::UnitConversion(int direction_enum){ 192 /*do nothing, no unit conversion*/ 193 } 194 /*}}}*/ -
issm/trunk/src/c/objects/Params/StringParam.h
r9320 r9356 77 77 void SetValue(FILE* fid){_error_("String param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));} 78 78 void SetValue(double** array, int M, int* mdim_array, int* ndim_array){_error_("String param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));} 79 void UnitConversion(int direction_enum); 79 80 80 81 char* GetParameterName(void); -
issm/trunk/src/c/shared/Numerics/UnitConversion.cpp
r9320 r9356 47 47 double scale; 48 48 switch(type_enum){ 49 case DtEnum: scale=1.0/yts;break; //yr 50 case NdtEnum: scale=1.0/yts;break; //yr 49 51 case TimeEnum: scale=1.0/yts;break; //yr 50 52 case VxEnum: scale=yts;break; //m/yr -
issm/trunk/src/c/solutions/control_core.cpp
r8926 r9356 46 46 47 47 /*Recover parameters used throughout the solution:{{{1*/ 48 femmodel->parameters->FindParam(&num_controls,NumControl sEnum);49 femmodel->parameters->FindParam(&num_responses,Num ResponsesEnum);48 femmodel->parameters->FindParam(&num_controls,NumControlTypeEnum); 49 femmodel->parameters->FindParam(&num_responses,NumCmResponsesEnum); 50 50 femmodel->parameters->FindParam(&control_type,NULL,ControlTypeEnum); 51 51 femmodel->parameters->FindParam(&responses,NULL,NULL,CmResponsesEnum); -
issm/trunk/src/c/solutions/controlrestart.cpp
r8926 r9356 15 15 16 16 /*retrieve output file name: */ 17 femmodel->parameters->FindParam(&num_controls,NumControl sEnum);17 femmodel->parameters->FindParam(&num_controls,NumControlTypeEnum); 18 18 femmodel->parameters->FindParam(&control_type,NULL,ControlTypeEnum); 19 19 femmodel->parameters->FindParam(&nsteps,NstepsEnum); -
issm/trunk/src/c/solutions/gradient_core.cpp
r8926 r9356 29 29 /*retrieve parameters:*/ 30 30 femmodel->parameters->FindParam(&control_steady,ControlSteadyEnum); 31 femmodel->parameters->FindParam(&num_controls,NumControl sEnum);31 femmodel->parameters->FindParam(&num_controls,NumControlTypeEnum); 32 32 femmodel->parameters->FindParam(&control_type,NULL,ControlTypeEnum); 33 33 femmodel->parameters->FindParam(&optscal_list,NULL,NULL,OptscalEnum); -
issm/trunk/src/c/solutions/transient_core.cpp
r9219 r9356 21 21 int solution_type; 22 22 int output_frequency; 23 int dim,g l_migration;23 int dim,groundingline_migration; 24 24 25 25 /*intermediary: */ … … 36 36 femmodel->parameters->FindParam(&output_frequency,OutputFrequencyEnum); 37 37 femmodel->parameters->FindParam(&time_adapt,TimeAdaptEnum); 38 femmodel->parameters->FindParam(&g l_migration,GroundingLineMigrationEnum);38 femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum); 39 39 femmodel->parameters->FindParam(&isdiagnostic,IsdiagnosticEnum); 40 40 femmodel->parameters->FindParam(&isprognostic,IsprognosticEnum); … … 76 76 } 77 77 78 if (g l_migration!=NoneEnum){78 if (groundingline_migration!=NoneEnum){ 79 79 if(dim==3) _error_("Grounding line migration not implemented in 3d"); 80 80 _printf_(VerboseSolution()," computing new grounding line position\n");
Note:
See TracChangeset
for help on using the changeset viewer.