| Last change
 on this file since 13590 was             13590, checked in by Eric.Larour, 13 years ago | 
        
          | 
CHG: replaced instances of MPI_COMM_WORLD in modules with IssmComm::GetComm()
 | 
        
          | File size:
            1001 bytes | 
      
      
| Rev | Line |  | 
|---|
| [5286] | 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 "../../include/include.h" | 
|---|
|  | 9 | #include "../../toolkits/toolkits.h" | 
|---|
|  | 10 | #include "../../EnumDefinitions/EnumDefinitions.h" | 
|---|
|  | 11 |  | 
|---|
| [13073] | 12 | void ThicknessAbsMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters,bool process_units, int weight_index){ | 
|---|
| [5286] | 13 |  | 
|---|
|  | 14 | /*Intermediary*/ | 
|---|
|  | 15 | int i; | 
|---|
|  | 16 | Element* element=NULL; | 
|---|
|  | 17 |  | 
|---|
|  | 18 | /*output: */ | 
|---|
| [13073] | 19 | IssmDouble J=0; | 
|---|
|  | 20 | IssmDouble J_sum; | 
|---|
| [5286] | 21 |  | 
|---|
|  | 22 | /*Compute Misfit: */ | 
|---|
|  | 23 | for (i=0;i<elements->Size();i++){ | 
|---|
|  | 24 | element=(Element*)elements->GetObjectByOffset(i); | 
|---|
| [8607] | 25 | J+=element->ThicknessAbsMisfit(process_units,weight_index); | 
|---|
| [5286] | 26 | } | 
|---|
|  | 27 |  | 
|---|
|  | 28 | /*Sum all J from all cpus of the cluster:*/ | 
|---|
| [12102] | 29 | #ifdef _HAVE_MPI_ | 
|---|
| [13590] | 30 | MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,IssmComm::GetComm() ); | 
|---|
|  | 31 | MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,IssmComm::GetComm()); | 
|---|
| [5286] | 32 | J=J_sum; | 
|---|
| [12102] | 33 | #endif | 
|---|
| [5286] | 34 |  | 
|---|
|  | 35 | /*Assign output pointers: */ | 
|---|
|  | 36 | *pJ=J; | 
|---|
|  | 37 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.