source: issm/trunk-jpl/src/c/modules/ModelProcessorx/Stressbalance/CreateLoadsStressbalance.cpp@ 15771

Last change on this file since 15771 was 15771, checked in by Mathieu Morlighem, 12 years ago

CHG: Diagnostic is now Stressbalance

File size: 2.7 KB
Line 
1/*! \file CreateLoadsStressbalance.c:
2 */
3
4#include "../../../toolkits/toolkits.h"
5#include "../../../classes/classes.h"
6#include "../../../shared/shared.h"
7#include "../ModelProcessorx.h"
8
9void CreateLoadsStressbalance(Loads** ploads, IoModel* iomodel){
10
11 /*DataSets*/
12 Pengrid *pengrid = NULL;
13
14 /*Intermediary*/
15 int segment_width;
16 int element;
17 int i;
18 int count;
19 int penpair_ids[2];
20 bool isSSA,isL1L2,isHO,isFS;
21 int numpenalties,numberofpressureloads,numrifts,numriftsegments;
22 IssmDouble *pressureload = NULL;
23 IssmDouble *elements_type = NULL;
24 IssmDouble *nodeoniceshelf = NULL;
25 IssmDouble *riftinfo = NULL;
26 IssmDouble *nodeonbed = NULL;
27 IssmDouble *nodeonFS = NULL;
28 IssmDouble *nodeonicesheet = NULL;
29 IssmDouble *vertices_type = NULL;
30 IssmDouble *penalties = NULL;
31
32 /*Fetch parameters: */
33 iomodel->Constant(&isL1L2,FlowequationIsL1L2Enum);
34 iomodel->Constant(&isFS,FlowequationIsFSEnum);
35 iomodel->Constant(&isSSA,FlowequationIsSSAEnum);
36 iomodel->Constant(&isHO,FlowequationIsHOEnum);
37 iomodel->Constant(&numrifts,RiftsNumriftsEnum);
38
39 /*Recover pointer: */
40 Loads* loads=*ploads;
41
42 /*Now, is the flag macayaealHO on? otherwise, do nothing: */
43 if(!isSSA & !isHO & !isFS & !isL1L2) return;
44
45 /*Initialize counter: */
46 count=0;
47
48 /*Create Penpair for penalties: */
49 iomodel->FetchData(&penalties,&numpenalties,NULL,StressbalanceVertexPairingEnum);
50
51 for(i=0;i<numpenalties;i++){
52
53 if(iomodel->my_vertices[reCast<int,IssmDouble>(penalties[2*i+0]-1)]){
54
55 /*In debugging mode, check that the second node is in the same cpu*/
56 _assert_(iomodel->my_vertices[(int)penalties[2*i+1]-1]);
57
58 /*Get node ids*/
59 penpair_ids[0]=iomodel->nodecounter+reCast<int,IssmDouble>(penalties[2*i+0]);
60 penpair_ids[1]=iomodel->nodecounter+reCast<int,IssmDouble>(penalties[2*i+1]);
61
62 /*Create Load*/
63 loads->AddObject(new Penpair(iomodel->loadcounter+count+1,&penpair_ids[0],StressbalanceAnalysisEnum));
64 count++;
65 }
66 }
67
68 /*free ressources: */
69 iomodel->DeleteData(penalties,StressbalanceVertexPairingEnum);
70
71 /*Create Riffront loads for rifts: */
72 #ifdef _HAVE_RIFTS_
73 if(numrifts){
74 iomodel->FetchData(&riftinfo,&numriftsegments,NULL,RiftsRiftstructEnum);
75 iomodel->FetchData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskVertexonfloatingiceEnum);
76 for(i=0;i<numriftsegments;i++){
77 if(iomodel->my_elements[reCast<int,IssmDouble>(*(riftinfo+RIFTINFOSIZE*i+2))-1]){
78 loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,StressbalanceAnalysisEnum));
79 count++;
80 }
81 }
82 iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskVertexonfloatingiceEnum);
83 xDelete<IssmDouble>(riftinfo);
84 }
85 #endif
86
87 /*Assign output pointer: */
88 *ploads=loads;
89}
Note: See TracBrowser for help on using the repository browser.