Changeset 24917
- Timestamp:
- 05/29/20 07:46:58 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r24916 r24917 4693 4693 IssmDouble oceanarea_cpu = 0.; 4694 4694 IssmDouble eartharea = 0.; 4695 IssmDouble eartharea_cpu = 0.; 4696 IssmDouble* RSLgi = NULL; 4697 int* indices = NULL; 4698 int gsize; 4699 4700 /*Initialize temporary vector that will be used to sum eustatic components on all local elements, prior 4701 * to assembly:*/ 4702 gsize = this->nodes->NumberOfDofs(GsetEnum); 4703 RSLgi=xNewZeroInit<IssmDouble>(gsize); 4704 indices=xNew<int>(gsize); for (int i=0;i<gsize;i++)indices[i]=i; 4695 IssmDouble eartharea_cpu = 0.; 4696 4697 /*Initialize temporary vector that will be used to sum eustatic components 4698 * on all local elements, prior to assembly:*/ 4699 int gsize = this->nodes->NumberOfDofs(GsetEnum); 4700 IssmDouble* RSLgi=xNewZeroInit<IssmDouble>(gsize); 4701 int* indices=xNew<int>(gsize); 4702 for(int i=0;i<gsize;i++) indices[i]=i; 4705 4703 4706 4704 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */ 4707 4705 for(int i=0;i<elements->Size();i++){ 4708 IssmDouble area; 4709 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 4710 area=element->GetAreaSpherical(); 4706 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 4707 IssmDouble area=element->GetAreaSpherical(); 4711 4708 eartharea_cpu += area; 4712 if 4709 if(element->IsOceanInElement()) oceanarea_cpu += area; 4713 4710 } 4714 4711 ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); … … 4725 4722 eustatic_cpu+=eustatic_cpu_e; 4726 4723 } 4724 4727 4725 /*Plug values once and assemble: */ 4728 4726 pRSLgi->SetValues(gsize,indices,RSLgi,ADD_VAL); … … 4739 4737 4740 4738 /*Assign output pointers:*/ 4741 *peartharea =eartharea;4742 *poceanarea =oceanarea;4743 *peustatic =eustatic;4739 *peartharea = eartharea; 4740 *poceanarea = oceanarea; 4741 *peustatic = eustatic; 4744 4742 4745 4743 }
Note:
See TracChangeset
for help on using the changeset viewer.