source: issm/oecreview/Archive/21337-21723/ISSM-21573-21574.diff@ 21726

Last change on this file since 21726 was 21726, checked in by Mathieu Morlighem, 8 years ago

CHG added Archive/21337-21723

File size: 5.7 KB
RevLine 
[21726]1Index: ../trunk-jpl/src/c/classes/FemModel.cpp
2===================================================================
3--- ../trunk-jpl/src/c/classes/FemModel.cpp (revision 21573)
4+++ ../trunk-jpl/src/c/classes/FemModel.cpp (revision 21574)
5@@ -2953,7 +2953,7 @@
6 }
7 /*}}}*/
8 void FemModel::ReMesh(void){/*{{{*/
9-
10+
11 /*Variables*/
12 IssmDouble *newx = NULL;
13 IssmDouble *newy = NULL;
14@@ -2972,9 +2972,7 @@
15 /*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/
16 this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
17
18- if(this->loads->Size()!=0){
19- _error_("not supported yet");
20- }
21+ if(this->loads->Size()!=0) _error_("not supported yet");
22
23 /*Create vertices*/
24 Vertices* new_vertices=new Vertices();
25@@ -3008,16 +3006,6 @@
26 if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints);
27 this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
28
29-
30- if(IssmComm::GetRank()==2){
31- _printf_("New constraints: CPU 1\n");
32- //this->constraints->DeepEcho();
33- new_constraints->DeepEcho();
34- printarray(my_vertices,newnumberofvertices,1);
35- _error_("stop!");
36- }
37-
38-
39 if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
40 constraintcounter = new_constraints->NumberOfConstraints();
41 /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
42@@ -3069,14 +3057,6 @@
43 /*Finally: interpolate all inputs and insert them into the new elements.*/
44 this->InterpolateInputs(new_vertices,new_elements);
45
46- if(IssmComm::GetRank()==2){
47- _printf_("New constraints: CPU 1\n");
48- //this->constraints->DeepEcho();
49- new_constraints->DeepEcho();
50- _error_("stop!");
51- }
52-
53-
54 /*Delete old structure and set new pointers*/
55 delete this->vertices; this->vertices = new_vertices;
56 delete this->elements; this->elements = new_elements;
57@@ -3630,13 +3610,6 @@
58 Vector<IssmDouble>* vspcvxflag = new Vector<IssmDouble>(numberofnodes_analysistype);
59 Vector<IssmDouble>* vspcvyflag = new Vector<IssmDouble>(numberofnodes_analysistype);
60
61- for(int i=0;i<numberofnodes_analysistype;i++){
62- vspcvx->SetValue(i,0.,INS_VAL);
63- vspcvy->SetValue(i,0.,INS_VAL);
64- vspcvxflag->SetValue(i,0.,INS_VAL);
65- vspcvyflag->SetValue(i,0.,INS_VAL);
66- }
67-
68 for(int i=0;i<this->constraints->Size();i++){
69 SpcStatic* spc = xDynamicCast<SpcStatic*>(this->constraints->GetObjectByOffset(i));
70 int dof = spc->GetDof();
71@@ -3644,10 +3617,7 @@
72 IssmDouble spcvalue = spc->GetValue();
73 int nodeindex = node-1;
74
75- if(IssmComm::GetRank()==0)
76- {//itapopo
77- if(dof==0) {//vx
78- if(IssmComm::GetRank()==0) _printf_("Node: " << nodeindex << "\tdof: " << dof << "\tspcvalue: " << spcvalue << "\n") ;
79+ if(dof==0) {//vx
80 vspcvx->SetValue(nodeindex,spcvalue,INS_VAL);
81 vspcvxflag->SetValue(nodeindex,1,INS_VAL);
82 }
83@@ -3655,30 +3625,14 @@
84 vspcvy->SetValue(nodeindex,spcvalue,INS_VAL);
85 vspcvyflag->SetValue(nodeindex,1,INS_VAL);
86 }
87-
88- }//itapopo
89 }
90
91- #ifdef _HAVE_PETSC_
92- _printf_("Tem PETSC\n");
93- #endif
94-
95 /*Assemble*/
96 vspcvx->Assemble();
97 vspcvy->Assemble();
98 vspcvxflag->Assemble();
99 vspcvyflag->Assemble();
100
101- IssmDouble pvalue1,pvalue2;
102- vspcvx->GetValue(&pvalue1,0);
103- vspcvxflag->GetValue(&pvalue2,0);
104- if(IssmComm::GetRank()==0) _printf_("Node: " << 0 << "\tspcvalue: " << pvalue1 << "\tflag: " << pvalue2 << "\n") ;
105- vspcvx->GetValue(&pvalue1,5);
106- vspcvxflag->GetValue(&pvalue2,5);
107- if(IssmComm::GetRank()==0) _printf_("Node: " << 5 << "\tspcvalue: " << pvalue1 << "\tflag: " << pvalue2 << "\n") ;
108-
109-
110-
111 /*Serialize*/
112 spcvx = vspcvx->ToMPISerial();
113 spcvy = vspcvy->ToMPISerial();
114@@ -3701,40 +3655,29 @@
115 InterpFromMeshToMesh2dx(&newspcvxflag,elementslist,x,y,nods_data,nels_data,spcvxflag,M_data,N_data,newx,newy,N_interp,NULL);
116 InterpFromMeshToMesh2dx(&newspcvyflag,elementslist,x,y,nods_data,nels_data,spcvyflag,M_data,N_data,newx,newy,N_interp,NULL);
117
118- if(IssmComm::GetRank()==1){
119- _printf_("CPU 1:\n");
120- _printf_("Old spcvx:\n");
121- printarray(spcvx,nods_data,1);
122- _printf_("Old spcvxflag:\n");
123- printarray(spcvxflag,nods_data,1);
124- _error_("Stop!!");
125- }
126-
127-
128-
129-
130-
131 int count = 0;
132 IssmDouble eps = 1.e-8;
133
134 /*Now, insert the interpolated constraints in the data set (constraints)*/
135 for(int i=0;i<newnumberofvertices;i++){
136- if(my_vertices[i])
137- /*spcvx*/
138- if(!xIsNan<IssmDouble>(newspcvx[i]) && newspcvxflag[i]>(1-eps)){
139- constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,0,newspcvx[i],StressbalanceAnalysisEnum));
140- //add count'th spc, on node i+1, setting dof 1 to vx.
141- count++;
142+ if(my_vertices[i]){
143+ /*spcvx*/
144+ if(!xIsNan<IssmDouble>(newspcvx[i]) && newspcvxflag[i]>(1-eps)){
145+ constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,0,newspcvx[i],StressbalanceAnalysisEnum));
146+ //add count'th spc, on node i+1, setting dof 1 to vx.
147+ count++;
148+ }
149 }
150 }
151 count=0;
152 for(int i=0;i<newnumberofvertices;i++){
153- if(my_vertices[i])
154- /*spcvy*/
155- if(!xIsNan<IssmDouble>(newspcvy[i]) && newspcvyflag[i]>(1-eps) ){
156- constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,1,newspcvy[i],StressbalanceAnalysisEnum));
157- //add count'th spc, on node i+1, setting dof 1 to vx.
158- count++;
159+ if(my_vertices[i]){
160+ /*spcvy*/
161+ if(!xIsNan<IssmDouble>(newspcvy[i]) && newspcvyflag[i]>(1-eps) ){
162+ constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,1,newspcvy[i],StressbalanceAnalysisEnum));
163+ //add count'th spc, on node i+1, setting dof 1 to vx.
164+ count++;
165+ }
166 }
167 }
168
Note: See TracBrowser for help on using the repository browser.