source: issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp@ 11695

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

Completed separation of Petsc from ISSM. Matrix and Vector
are now the vehicles for Mat and Vec objects when running with
Petsc, or double* when running with a custom made type of matrix (still
to be finished).

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