Last change
on this file since 13798 was 13798, checked in by Mathieu Morlighem, 12 years ago |
CHG: use dynamic_cast instead of C-style casting
|
File size:
877 bytes
|
Rev | Line | |
---|
[12773] | 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 |
|
---|
[13073] | 12 | void TotalSmbx(IssmDouble* pSmb, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters,bool process_units){
|
---|
[12773] | 13 |
|
---|
[13073] | 14 | IssmDouble local_smb = 0;
|
---|
| 15 | IssmDouble total_smb;
|
---|
[12773] | 16 |
|
---|
| 17 | for(int i=0;i<elements->Size();i++){
|
---|
[13798] | 18 | Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
|
---|
[12773] | 19 | local_smb+=element->TotalSmb();
|
---|
| 20 | }
|
---|
| 21 | #ifdef _HAVE_MPI_
|
---|
[13590] | 22 | MPI_Reduce(&local_smb,&total_smb,1,MPI_DOUBLE,MPI_SUM,0,IssmComm::GetComm() );
|
---|
| 23 | MPI_Bcast(&total_smb,1,MPI_DOUBLE,0,IssmComm::GetComm());
|
---|
[12773] | 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.