source: issm/trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp@ 16314

Last change on this file since 16314 was 16314, checked in by Mathieu Morlighem, 11 years ago

CHG: removing all references to weight_index

File size: 864 bytes
Line 
1/*!\file ThicknessAbsMisfitx
2 * \brief: compute misfit between observations and model
3 */
4
5#include "./ThicknessAbsMisfitx.h"
6
7#include "../../shared/shared.h"
8#include "../../toolkits/toolkits.h"
9
10void ThicknessAbsMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
11
12 /*Intermediary*/
13 int i;
14 Element* element=NULL;
15
16 /*output: */
17 IssmDouble J=0;
18 IssmDouble J_sum;
19
20 /*Compute Misfit: */
21 for (i=0;i<elements->Size();i++){
22 element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
23 J+=element->ThicknessAbsMisfit();
24 }
25
26 /*Sum all J from all cpus of the cluster:*/
27 ISSM_MPI_Reduce (&J,&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
28 ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
29 J=J_sum;
30
31 /*Assign output pointers: */
32 *pJ=J;
33}
Note: See TracBrowser for help on using the repository browser.