Last change
on this file since 15396 was 15396, checked in by Mathieu Morlighem, 12 years ago |
merged trunk-jpl and trunk for revision 15394
|
File size:
927 bytes
|
Rev | Line | |
---|
[8608] | 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 "../../toolkits/toolkits.h"
|
---|
| 9 |
|
---|
[15396] | 10 | void DragCoefficientAbsGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters,int weight_index){
|
---|
[8608] | 11 |
|
---|
| 12 | /*Intermediary*/
|
---|
| 13 | int i;
|
---|
| 14 | Element* element=NULL;
|
---|
| 15 |
|
---|
| 16 | /*output: */
|
---|
[13395] | 17 | IssmDouble J=0;
|
---|
| 18 | IssmDouble J_sum;
|
---|
[8608] | 19 |
|
---|
| 20 | /*Compute Misfit: */
|
---|
| 21 | for (i=0;i<elements->Size();i++){
|
---|
[13975] | 22 | element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
|
---|
[15396] | 23 | J+=element->DragCoefficientAbsGradient(weight_index);
|
---|
[8608] | 24 | }
|
---|
| 25 |
|
---|
| 26 | /*Sum all J from all cpus of the cluster:*/
|
---|
[12330] | 27 | #ifdef _HAVE_MPI_
|
---|
[13975] | 28 | MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,IssmComm::GetComm() );
|
---|
| 29 | MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,IssmComm::GetComm());
|
---|
[8608] | 30 | J=J_sum;
|
---|
[12330] | 31 | #endif
|
---|
[8608] | 32 |
|
---|
| 33 | /*Assign output pointers: */
|
---|
| 34 | *pJ=J;
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.