Last change
on this file since 8608 was 8608, checked in by Mathieu Morlighem, 14 years ago |
Added new modules for Thikonov regularization (now treated as a cost function, which makes more sense)
|
File size:
984 bytes
|
Line | |
---|
1 | /*!\file DragCoefficientAbsGradientx
|
---|
2 | * \brief: compute misfit between observations and model
|
---|
3 | */
|
---|
4 |
|
---|
5 | #include "./DragCoefficientAbsGradientx.h"
|
---|
6 |
|
---|
7 | #include "../../shared/shared.h"
|
---|
8 | #include "../../include/include.h"
|
---|
9 | #include "../../toolkits/toolkits.h"
|
---|
10 | #include "../../EnumDefinitions/EnumDefinitions.h"
|
---|
11 |
|
---|
12 | void DragCoefficientAbsGradientx( double* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters,bool process_units, int weight_index){
|
---|
13 |
|
---|
14 | /*Intermediary*/
|
---|
15 | int i;
|
---|
16 | Element* element=NULL;
|
---|
17 |
|
---|
18 | /*output: */
|
---|
19 | double J=0;
|
---|
20 | double J_sum;
|
---|
21 |
|
---|
22 | /*Compute Misfit: */
|
---|
23 | for (i=0;i<elements->Size();i++){
|
---|
24 | element=(Element*)elements->GetObjectByOffset(i);
|
---|
25 | J+=element->DragCoefficientAbsGradient(process_units,weight_index);
|
---|
26 | }
|
---|
27 |
|
---|
28 | /*Sum all J from all cpus of the cluster:*/
|
---|
29 | MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
|
---|
30 | MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
|
---|
31 | J=J_sum;
|
---|
32 |
|
---|
33 | /*Assign output pointers: */
|
---|
34 | *pJ=J;
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.