source: issm/trunk-jpl/src/c/modules/TotalSmbx/TotalSmbx.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: 853 bytes
Line 
1/*!\file TotalSmbx
2 * \brief: compute total ice sheet surface mass balance
3 */
4
5#include "./TotalSmbx.h"
6
7#include "../../shared/shared.h"
8#include "../../include/include.h"
9#include "../../toolkits/toolkits.h"
10#include "../../EnumDefinitions/EnumDefinitions.h"
11
12void TotalSmbx(IssmDouble* pSmb, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters,bool process_units){
13
14 IssmDouble local_smb = 0;
15 IssmDouble total_smb;
16
17 for(int i=0;i<elements->Size();i++){
18 Element* element=(Element*)elements->GetObjectByOffset(i);
19 local_smb+=element->TotalSmb();
20 }
21 #ifdef _HAVE_MPI_
22 MPI_Reduce(&local_smb,&total_smb,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
23 MPI_Bcast(&total_smb,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
24 #else
25 total_smb=local_smb;
26 #endif
27
28 /*Assign output pointers: */
29 *pSmb=total_smb;
30}
Note: See TracBrowser for help on using the repository browser.