Changeset 3460
- Timestamp:
- 04/08/10 08:51:55 (15 years ago)
- Location:
- issm/trunk/src/c/ModelProcessorx
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateParametersBalancedthickness.cpp
r3436 r3460 1 /*!\file: CreateParametersBalancedthickness.cpp2 1 * \brief driver for creating parameters dataset, for prognostic analysis. 3 2 */ … … 16 15 int count; 17 16 int i; 18 int dim;19 20 double* vx=NULL;21 double* vy=NULL;22 double* vz=NULL;23 17 double* u_g=NULL; 24 double* pressure=NULL;25 double* temperature=NULL;26 double* thickness=NULL;27 double* surface=NULL;28 double* bed=NULL;29 double* accumulation=NULL;30 double* melting=NULL;31 18 32 19 /*recover parameters : */ … … 36 23 37 24 /*Get vx and vy: */ 38 IoModelFetchData(& vx,NULL,NULL,iomodel_handle,"vx");39 IoModelFetchData(& vy,NULL,NULL,iomodel_handle,"vy");40 IoModelFetchData(& vz,NULL,NULL,iomodel_handle,"vz");25 IoModelFetchData(&iomodel->vx,NULL,NULL,iomodel_handle,"vx"); 26 IoModelFetchData(&iomodel->vy,NULL,NULL,iomodel_handle,"vy"); 27 IoModelFetchData(&iomodel->vz,NULL,NULL,iomodel_handle,"vz"); 41 28 42 29 u_g=(double*)xcalloc(iomodel->numberofvertices*3,sizeof(double)); 43 30 44 if( vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=vx[i]/iomodel->yts;45 if( vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=vy[i]/iomodel->yts;46 if( vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=vz[i]/iomodel->yts;31 if(iomodel->vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=iomodel->vx[i]/iomodel->yts; 32 if(iomodel->vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=iomodel->vy[i]/iomodel->yts; 33 if(iomodel->vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=iomodel->vz[i]/iomodel->yts; 47 34 48 35 count++; … … 52 39 53 40 54 xfree((void**)& vx);55 xfree((void**)& vy);56 xfree((void**)& vz);41 xfree((void**)&iomodel->vx); 42 xfree((void**)&iomodel->vy); 43 xfree((void**)&iomodel->vz); 57 44 xfree((void**)&u_g); 58 45 59 46 /*Get melting: */ 60 IoModelFetchData(& melting,NULL,NULL,iomodel_handle,"melting");61 if( melting) for(i=0;i<iomodel->numberofvertices;i++)melting[i]=melting[i]/iomodel->yts;47 IoModelFetchData(&iomodel->melting,NULL,NULL,iomodel_handle,"melting"); 48 if(iomodel->melting) for(i=0;i<iomodel->numberofvertices;i++)iomodel->melting[i]=iomodel->melting[i]/iomodel->yts; 62 49 63 50 count++; 64 51 param= new Param(count,"m_g",DOUBLEVEC); 65 if( melting) param->SetDoubleVec(melting,iomodel->numberofvertices,1);52 if(iomodel->melting) param->SetDoubleVec(melting,iomodel->numberofvertices,1); 66 53 else param->SetDoubleVec(melting,0,1); 67 54 parameters->AddObject(param); 68 55 69 56 /*Free melting: */ 70 xfree((void**)& melting);57 xfree((void**)&iomodel->melting); 71 58 72 59 /*Get accumulation: */ 73 IoModelFetchData(& accumulation,NULL,NULL,iomodel_handle,"accumulation");74 if( accumulation) for(i=0;i<iomodel->numberofvertices;i++)accumulation[i]=accumulation[i]/iomodel->yts;60 IoModelFetchData(&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation"); 61 if(iomodel->accumulation) for(i=0;i<iomodel->numberofvertices;i++)iomodel->accumulation[i]=iomodel->accumulation[i]/iomodel->yts; 75 62 76 63 count++; 77 64 param= new Param(count,"a_g",DOUBLEVEC); 78 if( accumulation) param->SetDoubleVec(accumulation,iomodel->numberofvertices,1);79 else param->SetDoubleVec( accumulation,0,0);65 if(iomodel->accumulation) param->SetDoubleVec(iomodel->accumulation,iomodel->numberofvertices,1); 66 else param->SetDoubleVec(iomodel->accumulation,0,0); 80 67 parameters->AddObject(param); 81 68 82 69 /*Free accumulation: */ 83 xfree((void**)& accumulation);70 xfree((void**)&iomodel->accumulation); 84 71 85 72 /*Assign output pointer: */ -
issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateParametersBalancedvelocities.cpp
r3436 r3460 16 16 int count; 17 17 int i; 18 int dim;19 20 double* vx=NULL;21 double* vy=NULL;22 double* vz=NULL;23 18 double* u_g=NULL; 24 double* pressure=NULL;25 double* temperature=NULL;26 double* thickness=NULL;27 double* surface=NULL;28 double* bed=NULL;29 double* accumulation=NULL;30 double* melting=NULL;31 19 32 20 /*recover parameters : */ … … 36 24 37 25 /*Get vx and vy: */ 38 IoModelFetchData(& vx,NULL,NULL,iomodel_handle,"vx");39 IoModelFetchData(& vy,NULL,NULL,iomodel_handle,"vy");40 IoModelFetchData(& vz,NULL,NULL,iomodel_handle,"vz");26 IoModelFetchData(&iomodel->vx,NULL,NULL,iomodel_handle,"vx"); 27 IoModelFetchData(&iomodel->vy,NULL,NULL,iomodel_handle,"vy"); 28 IoModelFetchData(&iomodel->vz,NULL,NULL,iomodel_handle,"vz"); 41 29 42 30 u_g=(double*)xcalloc(iomodel->numberofvertices*3,sizeof(double)); 43 31 44 if( vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=vx[i]/iomodel->yts;45 if( vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=vy[i]/iomodel->yts;46 if( vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=vz[i]/iomodel->yts;32 if(iomodel->vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=iomodel->vx[i]/iomodel->yts; 33 if(iomodel->vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=iomodel->vy[i]/iomodel->yts; 34 if(iomodel->vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=iomodel->vz[i]/iomodel->yts; 47 35 48 36 count++; … … 51 39 parameters->AddObject(param); 52 40 53 54 xfree((void**)&vx); 55 xfree((void**)&vy); 56 xfree((void**)&vz); 41 xfree((void**)&iomodel->vx); 42 xfree((void**)&iomodel->vy); 43 xfree((void**)&iomodel->vz); 57 44 xfree((void**)&u_g); 58 45 59 46 /*Get thickness: */ 60 IoModelFetchData(& thickness,NULL,NULL,iomodel_handle,"thickness");47 IoModelFetchData(&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness"); 61 48 62 49 count++; 63 50 param= new Param(count,"h_g",DOUBLEVEC); 64 if( thickness) param->SetDoubleVec(thickness,iomodel->numberofvertices,1);65 else param->SetDoubleVec( thickness,0,0);51 if(iomodel->thickness) param->SetDoubleVec(iomodel->thickness,iomodel->numberofvertices,1); 52 else param->SetDoubleVec(iomodel->thickness,0,0); 66 53 parameters->AddObject(param); 67 54 68 55 /*Free thickness: */ 69 xfree((void**)& thickness);56 xfree((void**)&iomodel->thickness); 70 57 71 58 /*Get melting: */ 72 IoModelFetchData(& melting,NULL,NULL,iomodel_handle,"melting");73 if( melting) for(i=0;i<iomodel->numberofvertices;i++)melting[i]=melting[i]/iomodel->yts;59 IoModelFetchData(&iomodel->melting,NULL,NULL,iomodel_handle,"melting"); 60 if(iomodel->melting) for(i=0;i<iomodel->numberofvertices;i++)iomodel->melting[i]=iomodel->melting[i]/iomodel->yts; 74 61 75 62 count++; 76 63 param= new Param(count,"m_g",DOUBLEVEC); 77 if( melting) param->SetDoubleVec(melting,iomodel->numberofvertices,1);78 else param->SetDoubleVec( melting,0,1);64 if(iomodel->melting) param->SetDoubleVec(iomodel->melting,iomodel->numberofvertices,1); 65 else param->SetDoubleVec(iomodel->melting,0,1); 79 66 parameters->AddObject(param); 80 67 81 68 /*Free melting: */ 82 xfree((void**)& melting);69 xfree((void**)&iomodel->melting); 83 70 84 71 /*Get accumulation: */ 85 IoModelFetchData(& accumulation,NULL,NULL,iomodel_handle,"accumulation");86 if( accumulation) for(i=0;i<iomodel->numberofvertices;i++)accumulation[i]=accumulation[i]/iomodel->yts;72 IoModelFetchData(&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation"); 73 if(iomodel->accumulation) for(i=0;i<iomodel->numberofvertices;i++)iomodel->accumulation[i]=iomodel->accumulation[i]/iomodel->yts; 87 74 88 75 count++; 89 76 param= new Param(count,"a_g",DOUBLEVEC); 90 if( accumulation) param->SetDoubleVec(accumulation,iomodel->numberofvertices,1);91 else param->SetDoubleVec( accumulation,0,0);77 if(iomodel->accumulation) param->SetDoubleVec(iomodel->accumulation,iomodel->numberofvertices,1); 78 else param->SetDoubleVec(iomodel->accumulation,0,0); 92 79 parameters->AddObject(param); 93 80 94 81 /*Free accumulation: */ 95 xfree((void**)& accumulation);82 xfree((void**)&iomodel->accumulation); 96 83 97 84 -
issm/trunk/src/c/ModelProcessorx/Melting/CreateParametersMelting.cpp
r3436 r3460 17 17 int i; 18 18 19 double* melting=NULL;20 21 19 /*recover parameters : */ 22 20 parameters=*pparameters; … … 31 29 32 30 /*Get melting: */ 33 IoModelFetchData(& melting,NULL,NULL,iomodel_handle,"melting");34 if( melting) {35 for(i=0;i<iomodel->numberofvertices;i++) melting[i]=melting[i]/iomodel->yts; //m/s instead of m/yr31 IoModelFetchData(&iomodel->melting,NULL,NULL,iomodel_handle,"melting"); 32 if(iomodel->melting) { 33 for(i=0;i<iomodel->numberofvertices;i++)iomodel->melting[i]=iomodel->melting[i]/iomodel->yts; //m/s instead of m/yr 36 34 } 37 35 else{ 38 for(i=0;i<iomodel->numberofvertices;i++) melting[i]=0;36 for(i=0;i<iomodel->numberofvertices;i++)iomodel->melting[i]=0; 39 37 } 40 38 41 39 count++; 42 40 param= new Param(count,"m_g",DOUBLEVEC); 43 if( melting) param->SetDoubleVec(melting,iomodel->numberofvertices);44 else param->SetDoubleVec( melting,0);41 if(iomodel->melting) param->SetDoubleVec(iomodel->melting,iomodel->numberofvertices); 42 else param->SetDoubleVec(iomodel->melting,0); 45 43 parameters->AddObject(param); 46 44 47 45 /*Free melting: */ 48 xfree((void**)& melting);46 xfree((void**)&iomodel->melting); 49 47 } 50 48 -
issm/trunk/src/c/ModelProcessorx/Prognostic/CreateParametersPrognostic.cpp
r3436 r3460 18 18 int i; 19 19 int dim; 20 21 double* vx=NULL;22 double* vy=NULL;23 double* vz=NULL;24 20 double* u_g=NULL; 25 double* pressure=NULL;26 double* temperature=NULL;27 double* thickness=NULL;28 double* surface=NULL;29 double* bed=NULL;30 double* accumulation=NULL;31 double* melting=NULL;32 21 33 22 /*recover parameters : */ … … 37 26 38 27 /*Get vx and vy: */ 39 IoModelFetchData(& vx,NULL,NULL,iomodel_handle,"vx");40 IoModelFetchData(& vy,NULL,NULL,iomodel_handle,"vy");41 IoModelFetchData(& vz,NULL,NULL,iomodel_handle,"vz");28 IoModelFetchData(&iomodel->vx,NULL,NULL,iomodel_handle,"vx"); 29 IoModelFetchData(&iomodel->vy,NULL,NULL,iomodel_handle,"vy"); 30 IoModelFetchData(&iomodel->vz,NULL,NULL,iomodel_handle,"vz"); 42 31 43 32 u_g=(double*)xcalloc(iomodel->numberofvertices*3,sizeof(double)); 44 33 45 if( vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=vx[i]/iomodel->yts;46 if( vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=vy[i]/iomodel->yts;47 if( vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=vz[i]/iomodel->yts;34 if(iomodel->vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=iomodel->vx[i]/iomodel->yts; 35 if(iomodel->vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=iomodel->vy[i]/iomodel->yts; 36 if(iomodel->vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=iomodel->vz[i]/iomodel->yts; 48 37 49 38 count++; … … 53 42 54 43 55 xfree((void**)& vx);56 xfree((void**)& vy);57 xfree((void**)& vz);44 xfree((void**)&iomodel->vx); 45 xfree((void**)&iomodel->vy); 46 xfree((void**)&iomodel->vz); 58 47 xfree((void**)&u_g); 59 48 … … 89 78 90 79 /*Get thickness: */ 91 IoModelFetchData(& thickness,NULL,NULL,iomodel_handle,"thickness");80 IoModelFetchData(&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness"); 92 81 93 82 count++; 94 83 param= new Param(count,"h_g",DOUBLEVEC); 95 if( thickness) param->SetDoubleVec(thickness,iomodel->numberofvertices,1);96 else param->SetDoubleVec( thickness,0,0);84 if(iomodel->thickness) param->SetDoubleVec(iomodel->thickness,iomodel->numberofvertices,1); 85 else param->SetDoubleVec(iomodel->thickness,0,0); 97 86 parameters->AddObject(param); 98 87 99 88 /*Free thickness: */ 100 xfree((void**)& thickness);89 xfree((void**)&iomodel->thickness); 101 90 102 91 /*Get surface: */ 103 IoModelFetchData(& surface,NULL,NULL,iomodel_handle,"surface");92 IoModelFetchData(&iomodel->surface,NULL,NULL,iomodel_handle,"surface"); 104 93 105 94 count++; 106 95 param= new Param(count,"s_g",DOUBLEVEC); 107 if( surface) param->SetDoubleVec(surface,iomodel->numberofvertices,1);108 else param->SetDoubleVec( surface,0,0);96 if(iomodel->surface) param->SetDoubleVec(iomodel->surface,iomodel->numberofvertices,1); 97 else param->SetDoubleVec(iomodel->surface,0,0); 109 98 parameters->AddObject(param); 110 99 111 100 /*Free surface: */ 112 xfree((void**)& surface);101 xfree((void**)&iomodel->surface); 113 102 114 103 /*Get bed: */ 115 IoModelFetchData(& bed,NULL,NULL,iomodel_handle,"bed");104 IoModelFetchData(&iomodel->bed,NULL,NULL,iomodel_handle,"bed"); 116 105 117 106 count++; 118 107 param= new Param(count,"b_g",DOUBLEVEC); 119 if( bed) param->SetDoubleVec(bed,iomodel->numberofvertices,1);120 else param->SetDoubleVec( bed,0,0);108 if(iomodel->bed) param->SetDoubleVec(iomodel->bed,iomodel->numberofvertices,1); 109 else param->SetDoubleVec(iomodel->bed,0,0); 121 110 parameters->AddObject(param); 122 111 123 112 /*Free bed: */ 124 xfree((void**)& bed);113 xfree((void**)&iomodel->bed); 125 114 126 115 /*Get melting: */ 127 IoModelFetchData(& melting,NULL,NULL,iomodel_handle,"melting");128 if( melting) for(i=0;i<iomodel->numberofvertices;i++)melting[i]=melting[i]/iomodel->yts;116 IoModelFetchData(&iiomodel->melting,NULL,NULL,iomodel_handle,"melting"); 117 if(iomodel->melting) for(i=0;i<iomodel->numberofvertices;i++)iomodel->melting[i]=iomodel->melting[i]/iomodel->yts; 129 118 130 119 count++; 131 120 param= new Param(count,"m_g",DOUBLEVEC); 132 if( melting) param->SetDoubleVec(melting,iomodel->numberofvertices,1);133 else param->SetDoubleVec( melting,0,1);121 if(iomodel->melting) param->SetDoubleVec(iomodel->melting,iomodel->numberofvertices,1); 122 else param->SetDoubleVec(iomodel->melting,0,1); 134 123 parameters->AddObject(param); 135 124 136 125 /*Free melting: */ 137 xfree((void**)& melting);126 xfree((void**)&iomodel->melting); 138 127 139 128 /*Get accumulation: */ 140 IoModelFetchData(& accumulation,NULL,NULL,iomodel_handle,"accumulation");141 if( accumulation) for(i=0;i<iomodel->numberofvertices;i++)accumulation[i]=accumulation[i]/iomodel->yts;129 IoModelFetchData(&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation"); 130 if(iomodel->accumulation) for(i=0;i<iomodel->numberofvertices;i++)iomodel->accumulation[i]=iomodel->accumulation[i]/iomodel->yts; 142 131 143 132 count++; 144 133 param= new Param(count,"a_g",DOUBLEVEC); 145 if( accumulation) param->SetDoubleVec(accumulation,iomodel->numberofvertices,1);146 else param->SetDoubleVec( accumulation,0,0);134 if(iomodel->accumulation) param->SetDoubleVec(iomodel->accumulation,iomodel->numberofvertices,1); 135 else param->SetDoubleVec(iomodel->accumulation,0,0); 147 136 parameters->AddObject(param); 148 137 149 138 /*Free accumulation: */ 150 xfree((void**)&accumulation); 151 139 xfree((void**)&iomodel->accumulation); 152 140 153 141 /*Assign output pointer: */ -
issm/trunk/src/c/ModelProcessorx/Thermal/CreateParametersThermal.cpp
r3436 r3460 17 17 int count; 18 18 int i; 19 20 double* vx=NULL;21 double* vy=NULL;22 double* vz=NULL;23 19 double* u_g=NULL; 24 double* pressure=NULL;25 double* temperature=NULL;26 20 27 21 /*recover parameters : */ … … 40 34 41 35 /*Get vx vy and vz: */ 42 IoModelFetchData(& vx,NULL,NULL,iomodel_handle,"vx");43 IoModelFetchData(& vy,NULL,NULL,iomodel_handle,"vy");44 IoModelFetchData(& vz,NULL,NULL,iomodel_handle,"vz");36 IoModelFetchData(&iomodel->vx,NULL,NULL,iomodel_handle,"vx"); 37 IoModelFetchData(&iomodel->vy,NULL,NULL,iomodel_handle,"vy"); 38 IoModelFetchData(&iomodel->vz,NULL,NULL,iomodel_handle,"vz"); 45 39 46 40 u_g=(double*)xcalloc(iomodel->numberofvertices*3,sizeof(double)); 47 41 48 if( vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=vx[i]/iomodel->yts;49 if( vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=vy[i]/iomodel->yts;50 if( vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=vz[i]/iomodel->yts;42 if(iomodel->vx) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+0]=iomodel->vx[i]/iomodel->yts; 43 if(iomodel->vy) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+1]=iomodel->vy[i]/iomodel->yts; 44 if(iomodel->vz) for(i=0;i<iomodel->numberofvertices;i++)u_g[3*i+2]=iomodel->vz[i]/iomodel->yts; 51 45 52 46 count++; … … 55 49 parameters->AddObject(param); 56 50 57 xfree((void**)& vx);58 xfree((void**)& vy);59 xfree((void**)& vz);51 xfree((void**)&iomodel->vx); 52 xfree((void**)&iomodel->vy); 53 xfree((void**)&iomodel->vz); 60 54 xfree((void**)&u_g); 61 55 62 56 /*Get pressure: */ 63 IoModelFetchData(& pressure,NULL,NULL,iomodel_handle,"pressure");57 IoModelFetchData(&iomodel->pressure,NULL,NULL,iomodel_handle,"pressure"); 64 58 65 59 count++; 66 60 param= new Param(count,"p_g",DOUBLEVEC); 67 if( pressure) param->SetDoubleVec(pressure,iomodel->numberofvertices,1);68 else param->SetDoubleVec( pressure,0,0);61 if(iomodel->pressure) param->SetDoubleVec(iomodel->pressure,iomodel->numberofvertices,1); 62 else param->SetDoubleVec(iomodel->pressure,0,0); 69 63 parameters->AddObject(param); 70 64 71 65 /*Free pressure: */ 72 xfree((void**)& pressure);66 xfree((void**)&iomodel->pressure); 73 67 74 68 /* get initial temperature and melting if transient*/ … … 76 70 77 71 /*Get melting and temperature: */ 78 IoModelFetchData(& temperature,NULL,NULL,iomodel_handle,"temperature");72 IoModelFetchData(&iomodel->temperature,NULL,NULL,iomodel_handle,"temperature"); 79 73 80 74 count++; 81 75 param= new Param(count,"t_g",DOUBLEVEC); 82 if( temperature) param->SetDoubleVec(temperature,iomodel->numberofvertices,1);76 if(iomodel->temperature) param->SetDoubleVec(iomodel->temperature,iomodel->numberofvertices,1); 83 77 else ISSMERROR(exprintf("Missing initial temperature")); 84 78 parameters->AddObject(param); 85 79 86 80 /*Free temperature: */ 87 xfree((void**)& temperature);81 xfree((void**)&iomodel->temperature); 88 82 } 89 83
Note:
See TracChangeset
for help on using the changeset viewer.