source: issm/trunk-jpl/src/c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp@ 13073

Last change on this file since 13073 was 13073, checked in by Eric.Larour, 13 years ago

CHG: extended rest of the code (except for kriging code) to use IssmDouble
and IssmPDouble active and passive types, for use with AD type constructs (using
ADOLC or ADIC in the future).

File size: 1.3 KB
Line 
1/*!\file ControlInputScaleGradientx
2 * \brief retrieve gradient from inputs in elements
3 */
4
5#include "./ControlInputScaleGradientx.h"
6#include "../../shared/shared.h"
7#include "../../include/include.h"
8#include "../../toolkits/toolkits.h"
9#include "../../EnumDefinitions/EnumDefinitions.h"
10
11void ControlInputScaleGradientx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* norm_list,int step){
12
13 /*Intermediaries*/
14 int i,j,num_controls;
15 int *control_type = NULL;
16 IssmDouble *scalar_list = NULL;
17 IssmDouble scalar;
18
19
20 /*Retrieve some parameters*/
21 parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
22 parameters->FindParam(&control_type,NULL,InversionControlParametersEnum);
23 parameters->FindParam(&scalar_list,NULL,NULL,InversionGradientScalingEnum);
24
25 /*Compute scaling factor*/
26 scalar=scalar_list[0]/norm_list[0];
27 for(i=0;i<num_controls;i++){
28 scalar=min(scalar,scalar_list[num_controls*step+i]/norm_list[i]);
29 }
30
31 for(i=0;i<num_controls;i++){
32 for(j=0;j<elements->Size();j++){
33 Element* element=(Element*)elements->GetObjectByOffset(j);
34 element->ControlInputScaleGradient(control_type[i],scalar);
35 }
36 }
37
38 /*Clean up and return*/
39 xDelete<int>(control_type);
40 xDelete<IssmDouble>(scalar_list);
41}
Note: See TracBrowser for help on using the repository browser.