Changeset 24352
- Timestamp:
- 11/18/19 20:56:14 (5 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r24351 r24352 2217 2217 delete gauss; 2218 2218 xDelete<IssmDouble>(timesteps); 2219 } 2220 /*}}}*/ 2221 void Tria::GetInputAveragesUpToCurrentTime(int input_enum,IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/ 2222 2223 /*Get transient input time steps*/ 2224 int numtimesteps; 2225 IssmDouble *timesteps = NULL; 2226 TransientInput2* transient_input = this->inputs2->GetTransientInput(input_enum); 2227 transient_input->GetAllTimes(×teps,&numtimesteps); 2228 2229 /*Figure out how many time steps we are going to return: */ 2230 int numsteps = 0; 2231 bool iscurrenttime_included = false; 2232 for(int i=0;i<numtimesteps;i++){ 2233 if(timesteps[i]==currenttime) iscurrenttime_included=true; 2234 if(timesteps[i]>currenttime) break; 2235 else numsteps++; 2236 } 2237 if(iscurrenttime_included==false)numsteps++; 2238 2239 /*allocate: */ 2240 IssmDouble* times=xNew<IssmDouble>(numsteps); 2241 IssmDouble* values=xNew<IssmDouble>(numsteps); 2242 2243 for(int i=0;i<numsteps;i++){ 2244 if((iscurrenttime_included==false) && (i==(numsteps-1))){ 2245 Input2* input = this->GetInput2(input_enum,currenttime); 2246 input->GetInputAverage(&values[i]); 2247 times[i]=currenttime; 2248 } 2249 else{ 2250 TriaInput2* input = transient_input->GetTriaInput(i); 2251 this->InputServe(input); 2252 input->GetInputAverage(&values[i]); 2253 times[i]=timesteps[i]; 2254 } 2255 } 2256 2257 /*Assign output pointers*/ 2258 *pvalues=values; 2259 *ptimes=times; 2260 *pnumtimes=numtimesteps; 2219 2261 } 2220 2262 /*}}}*/ … … 5158 5200 5159 5201 /*pull thickness averages! */ 5160 TransientInput2* thickness_input=this->inputs2->GetTransientInput(ThicknessEnum); 5161 IssmDouble* hes=NULL; 5162 IssmDouble* times=NULL; 5202 IssmDouble *hes = NULL; 5203 IssmDouble *times = NULL; 5163 5204 int numtimes; 5164 _error_("Next line not implemented yet"); 5165 //thickness_input->GetInputAveragesUpToCurrentTime(&hes,×,&numtimes,currenttime); 5166 5205 this->GetInputAveragesUpToCurrentTime(ThicknessEnum,&hes,×,&numtimes,currenttime); 5167 5206 5168 5207 /*recover mantle viscosity: */ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r24351 r24352 177 177 void DatasetInputCreate(IssmDouble* array,int M,int N,int* individual_enums,int num_inputs,Inputs2* inputs2,IoModel* iomodel,int input_enum); 178 178 void CreateInputTimeAverage(int transientinput_enum,int averagedinput_enum,IssmDouble init_time,IssmDouble end_time); 179 void GetInputAveragesUpToCurrentTime(int input_enum,IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime); 179 180 IssmDouble GetArea(void); 180 181 IssmDouble GetHorizontalSurfaceArea(void);
Note:
See TracChangeset
for help on using the changeset viewer.