Changeset 17514
- Timestamp:
- 03/21/14 09:18:17 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp
r17513 r17514 89 89 /*}}}*/ 90 90 /*FUNCTION ElementHook::SpawnTriaHook{{{*/ 91 void ElementHook::SpawnTriaHook(ElementHook* triahook,int location){92 93 /*Create arrow of indices depending on location (0=base 1=surface)*/94 int indices[3];95 switch(location){96 case 0:97 indices[0] = 0;98 indices[1] = 1;99 indices[2] = 2;100 break;101 case 1:102 indices[0] = 3;103 indices[1] = 4;104 indices[2] = 5;105 break;106 default:107 _error_("case "<<location<<" not supported");108 }109 110 triahook->numanalyses=this->numanalyses;111 112 /*Spawn nodes hook*/113 triahook->hnodes=new Hook*[this->numanalyses];114 for(int i=0;i<this->numanalyses;i++){115 /*Do not do anything if Hook is empty*/116 if (!this->hnodes[i] || this->hnodes[i]->GetNum()==0){117 triahook->hnodes[i]=NULL;118 }119 else{120 triahook->hnodes[i]=this->hnodes[i]->Spawn(indices,3);121 }122 }123 124 /*do not spawn hmaterial. material will be taken care of by Penta*/125 triahook->hmaterial=NULL;126 triahook->hvertices=(Hook*)this->hvertices->Spawn(indices,3);127 triahook->hmatpar=(Hook*)this->hmatpar->copy();128 }129 /*}}}*/130 /*FUNCTION ElementHook::SpawnTriaHook{{{*/131 91 void ElementHook::SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3){ 132 92 -
issm/trunk-jpl/src/c/classes/Elements/ElementHook.h
r17513 r17514 25 25 26 26 void SetHookNodes(int* node_ids,int numnodes,int analysis_counter); 27 void SpawnTriaHook(ElementHook* triahook,int location); //3d only TO BE REMOVED (replaced by the one below)28 27 void SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3); //3d only 29 28 void SpawnSegHook(ElementHook* triahook,int ndex1,int index2); //2d only -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r17472 r17514 2144 2144 /*}}}*/ 2145 2145 /*FUNCTION Penta::SpawnTria {{{*/ 2146 Tria* Penta::SpawnTria(int location){2146 Tria* Penta::SpawnTria(int index1,int index2,int index3){ 2147 2147 2148 2148 int analysis_counter; … … 2154 2154 Tria* tria=new Tria(); 2155 2155 tria->id=this->id; 2156 tria->inputs=(Inputs*)this->inputs->SpawnTriaInputs( location);2156 tria->inputs=(Inputs*)this->inputs->SpawnTriaInputs(index1,index2,index3); 2157 2157 tria->parameters=this->parameters; 2158 2158 tria->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED) 2159 this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria), location);2159 this->SpawnTriaHook(dynamic_cast<ElementHook*>(tria),index1,index2,index3); 2160 2160 2161 2161 /*Spawn material*/ … … 2180 2180 if(this->inputs->GetInput(VxEnum)) this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 2181 2181 if(this->inputs->GetInput(VyEnum)) this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); 2182 Tria* tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.2182 Tria* tria=(Tria*)SpawnTria(0,1,2); 2183 2183 this->inputs->DeleteInput(MaterialsRheologyBbarEnum); 2184 2184 this->inputs->DeleteInput(DamageDbarEnum); … … 2194 2194 _assert_(this->IsOnSurface()); 2195 2195 2196 Tria* tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.2196 Tria* tria=(Tria*)SpawnTria(3,4,5); 2197 2197 2198 2198 return tria; … … 2268 2268 /*This element should be collapsed into a tria element at its base. Create this tria element, 2269 2269 * and compute SurfaceArea*/ 2270 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.2270 tria=(Tria*)SpawnTria(0,1,2); 2271 2271 S=tria->SurfaceArea(); 2272 2272 delete tria->material; delete tria; … … 2275 2275 else{ 2276 2276 2277 tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.2277 tria=(Tria*)SpawnTria(3,4,5); 2278 2278 S=tria->SurfaceArea(); 2279 2279 delete tria->material; delete tria; … … 2892 2892 2893 2893 /*Spawn Tria element from the base of the Penta: */ 2894 Tria* tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.2894 Tria* tria=(Tria*)SpawnTria(0,1,2); 2895 2895 mass_flux=tria->MassFlux(segment); 2896 2896 delete tria->material; delete tria; … … 2916 2916 2917 2917 /*Spawn Tria element from the base of the Penta: */ 2918 Tria* tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.2918 Tria* tria=(Tria*)SpawnTria(0,1,2); 2919 2919 mass_flux=tria->MassFlux(x1,y1,x2,y2,segment_id); 2920 2920 delete tria->material; delete tria; … … 3268 3268 case DragCoefficientAbsGradientEnum: 3269 3269 if(IsOnBed()){ 3270 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3270 tria=(Tria*)SpawnTria(0,1,2); 3271 3271 tria->GradjDragGradient(gradient,control_index); 3272 3272 delete tria->material; delete tria; … … 3275 3275 case RheologyBbarAbsGradientEnum: 3276 3276 if(IsOnBed()){ 3277 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3277 tria=(Tria*)SpawnTria(0,1,2); 3278 3278 tria->GradjBGradient(gradient,control_index); 3279 3279 delete tria->material; delete tria; … … 3293 3293 3294 3294 /*Spawn tria*/ 3295 Tria* tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3295 Tria* tria=(Tria*)SpawnTria(0,1,2); 3296 3296 tria->GradjDragSSA(gradient,control_index); 3297 3297 delete tria->material; delete tria; … … 3472 3472 3473 3473 /*Collapse element to the base*/ 3474 Tria* tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3474 Tria* tria=(Tria*)SpawnTria(0,1,2); 3475 3475 tria->GradjBSSA(gradient,control_index); 3476 3476 delete tria->material; delete tria; … … 3492 3492 3493 3493 /*Collapse element to the base*/ 3494 Tria* tria=(Tria*)SpawnTria(0 );3494 Tria* tria=(Tria*)SpawnTria(0,1,2); 3495 3495 tria->GradjBSSA(gradient,control_index); //We use SSA as an estimate for now 3496 3496 delete tria->material; delete tria; … … 3511 3511 3512 3512 /*Collapse element to the base*/ 3513 Tria* tria=(Tria*)SpawnTria(0 );3513 Tria* tria=(Tria*)SpawnTria(0,1,2); 3514 3514 tria->GradjBSSA(gradient,control_index); //We use SSA as an estimate for now 3515 3515 delete tria->material; delete tria; … … 3586 3586 /*This element should be collapsed into a tria element at its base. Create this tria element, 3587 3587 * and compute SurfaceAverageVelMisfit*/ 3588 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3588 tria=(Tria*)SpawnTria(0,1,2); 3589 3589 J=tria->SurfaceAverageVelMisfit(); 3590 3590 delete tria->material; delete tria; … … 3593 3593 else{ 3594 3594 3595 tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.3595 tria=(Tria*)SpawnTria(3,4,5); 3596 3596 J=tria->SurfaceAverageVelMisfit(); 3597 3597 delete tria->material; delete tria; … … 3623 3623 /*This element should be collapsed into a tria element at its base. Create this tria element, 3624 3624 * and compute SurfaceAbsVelMisfit*/ 3625 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3625 tria=(Tria*)SpawnTria(0,1,2); 3626 3626 J=tria->SurfaceAbsVelMisfit(); 3627 3627 delete tria->material; delete tria; … … 3630 3630 else{ 3631 3631 3632 tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.3632 tria=(Tria*)SpawnTria(3,4,5); 3633 3633 J=tria->SurfaceAbsVelMisfit(); 3634 3634 delete tria->material; delete tria; … … 3660 3660 /*This element should be collapsed into a tria element at its base. Create this tria element, 3661 3661 * and compute SurfaceLogVelMisfit*/ 3662 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3662 tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1. 3663 3663 J=tria->SurfaceLogVelMisfit(); 3664 3664 delete tria->material; delete tria; … … 3667 3667 else{ 3668 3668 3669 tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.3669 tria=(Tria*)SpawnTria(3,4,5); //lower face is 0, upper face is 1. 3670 3670 J=tria->SurfaceLogVelMisfit(); 3671 3671 delete tria->material; delete tria; … … 3699 3699 /*This element should be collapsed into a tria element at its base. Create this tria element, 3700 3700 * and compute SurfaceLogVxVyMisfit*/ 3701 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3701 tria=(Tria*)SpawnTria(0,1,2); 3702 3702 J=tria->SurfaceLogVxVyMisfit(); 3703 3703 delete tria->material; delete tria; … … 3706 3706 else{ 3707 3707 3708 tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.3708 tria=(Tria*)SpawnTria(3,4,5); 3709 3709 J=tria->SurfaceLogVxVyMisfit(); 3710 3710 delete tria->material; delete tria; … … 3736 3736 /*This element should be collapsed into a tria element at its base. Create this tria element, 3737 3737 * and compute SurfaceRelVelMisfit*/ 3738 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 1.3738 tria=(Tria*)SpawnTria(0,1,2); 3739 3739 J=tria->SurfaceRelVelMisfit(); 3740 3740 delete tria->material; delete tria; … … 3743 3743 else{ 3744 3744 3745 tria=(Tria*)SpawnTria( 1); //lower face is 0, upper face is 1.3745 tria=(Tria*)SpawnTria(3,4,5); 3746 3746 J=tria->SurfaceRelVelMisfit(); 3747 3747 delete tria->material; delete tria; … … 3770 3770 _error_("Not implemented yet"); 3771 3771 3772 tria=(Tria*)SpawnTria(0 );3772 tria=(Tria*)SpawnTria(0,1,2); 3773 3773 J=tria->ThicknessAbsMisfit(); 3774 3774 delete tria->material; delete tria; … … 3785 3785 if(!IsIceInElement()|| IsFloating() || !IsOnBed()) return 0; 3786 3786 3787 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 13787 tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1 3788 3788 J=tria->DragCoefficientAbsGradient(); 3789 3789 delete tria->material; delete tria; … … 3800 3800 if(!IsIceInElement() || !IsOnBed()) return 0; 3801 3801 3802 tria=(Tria*)SpawnTria(0 ); //lower face is 0, upper face is 13802 tria=(Tria*)SpawnTria(0,1,2); 3803 3803 J=tria->RheologyBbarAbsGradient(); 3804 3804 delete tria->material; delete tria; -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r17472 r17514 227 227 IssmDouble MinEdgeLength(IssmDouble* xyz_list); 228 228 void SetClone(int* minranks); 229 Tria* SpawnTria(int location);229 Tria* SpawnTria(int index1,int index2,int index3); 230 230 IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa); 231 231 -
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
r17513 r17514 66 66 67 67 return this->enum_type; 68 69 }70 /*}}}*/71 /*FUNCTION BoolInput::SpawnTriaInput{{{*/72 Input* BoolInput::SpawnTriaInput(int location){73 74 /*output*/75 BoolInput* outinput=new BoolInput();76 77 /*only copy current value*/78 outinput->enum_type=this->enum_type;79 outinput->value=this->value;80 81 /*Assign output*/82 return outinput;83 68 84 69 } -
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
r17513 r17514 30 30 /*BoolInput management: {{{*/ 31 31 int InstanceEnum(); 32 Input* SpawnTriaInput(int location);33 32 Input* SpawnTriaInput(int index1,int index2,int index3); 34 33 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
r17513 r17514 193 193 }/*}}}*/ 194 194 /*FUNCTION ControlInput::SpawnTriaInput{{{*/ 195 Input* ControlInput::SpawnTriaInput(int location){196 return values->SpawnTriaInput(location);197 }/*}}}*/198 /*FUNCTION ControlInput::SpawnTriaInput{{{*/199 195 Input* ControlInput::SpawnTriaInput(int index1,int index2,int index3){ 200 196 return values->SpawnTriaInput(index1,index2,index3); -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
r17513 r17514 38 38 /*ControlInput management: {{{*/ 39 39 int InstanceEnum(); 40 Input* SpawnTriaInput(int location);41 40 Input* SpawnTriaInput(int index1,int index2,int index3); 42 41 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
r17513 r17514 76 76 77 77 return output; 78 }79 /*}}}*/80 /*FUNCTION DatasetInput::SpawnTriaInput{{{*/81 Input* DatasetInput::SpawnTriaInput(int location){82 83 /*output*/84 DatasetInput* outinput=NULL;85 86 /*Create new Datasetinput (copy of current input)*/87 outinput=new DatasetInput();88 outinput->enum_type=this->enum_type;89 outinput->inputs=dynamic_cast<Inputs*>(this->inputs->SpawnTriaInputs(location));90 outinput->numids=this->numids;91 outinput->ids=xNew<int>(this->numids);92 xMemCpy(outinput->ids,this->ids,this->numids);93 94 /*Assign output*/95 return outinput;96 78 } 97 79 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
r17513 r17514 36 36 void AddInput(Input* input,int id); 37 37 int InstanceEnum(); 38 Input* SpawnTriaInput(int location);39 38 Input* SpawnTriaInput(int index1,int index2,int index3); 40 39 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
r17513 r17514 70 70 /*}}}*/ 71 71 /*FUNCTION DoubleInput::SpawnTriaInput{{{*/ 72 Input* DoubleInput::SpawnTriaInput(int location){73 74 /*output*/75 DoubleInput* outinput=new DoubleInput();76 77 /*only copy current value*/78 outinput->enum_type=this->enum_type;79 outinput->value=this->value;80 81 /*Assign output*/82 return outinput;83 84 }85 /*}}}*/86 /*FUNCTION DoubleInput::SpawnTriaInput{{{*/87 72 Input* DoubleInput::SpawnTriaInput(int index1,int index2,int index3){ 88 73 -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
r17513 r17514 33 33 /*DoubleInput management: {{{*/ 34 34 int InstanceEnum(); 35 Input* SpawnTriaInput(int location);36 35 Input* SpawnTriaInput(int index1,int index2,int index3); 37 36 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/Input.h
r17513 r17514 54 54 virtual void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0; 55 55 56 virtual Input* SpawnTriaInput(int location)=0;57 56 virtual Input* SpawnTriaInput(int index1,int index2,int index3)=0; 58 57 virtual Input* SpawnSegInput(int index1,int index2)=0; -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp
r17513 r17514 370 370 /*}}}*/ 371 371 /*FUNCTION Inputs::SpawnTriaInputs{{{*/ 372 Inputs* Inputs::SpawnTriaInputs(int location){373 374 /*Intermediary*/375 vector<Object*>::iterator object;376 Input* inputin=NULL;377 Input* inputout=NULL;378 379 /*Output*/380 Inputs* newinputs=new Inputs();381 382 /*Go through inputs and call Spawn function*/383 for ( object=objects.begin() ; object < objects.end(); object++ ){384 385 /*Create new input*/386 inputin=dynamic_cast<Input*>(*object);387 inputout=inputin->SpawnTriaInput(location);388 389 /*Add input to new inputs*/390 newinputs->AddObject(inputout);391 }392 393 /*Assign output pointer*/394 return newinputs;395 }396 /*}}}*/397 /*FUNCTION Inputs::SpawnTriaInputs{{{*/398 372 Inputs* Inputs::SpawnTriaInputs(int index1,int index2,int index3){ 399 373 -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp
r17513 r17514 67 67 return this->enum_type; 68 68 69 }70 /*}}}*/71 /*FUNCTION IntInput::SpawnTriaInput{{{*/72 Input* IntInput::SpawnTriaInput(int location){73 74 /*output*/75 IntInput* outinput=new IntInput();76 77 /*only copy current value*/78 outinput->enum_type=this->enum_type;79 outinput->value=this->value;80 81 /*Assign output*/82 return outinput;83 69 } 84 70 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
r17513 r17514 34 34 /*IntInput management: {{{*/ 35 35 int InstanceEnum(); 36 Input* SpawnTriaInput(int location);37 36 Input* SpawnTriaInput(int index1,int index2,int index3); 38 37 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
r17513 r17514 79 79 return this->enum_type; 80 80 81 }82 /*}}}*/83 /*FUNCTION PentaInput::SpawnTriaInput{{{*/84 Input* PentaInput::SpawnTriaInput(int location){85 86 /*output*/87 TriaInput* outinput=NULL;88 89 if(this->element_type==P0Enum){90 outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);91 }92 else{93 /*Assume P1 interpolation only for now*/94 IssmDouble newvalues[3];95 96 /*Create array of indices depending on location (0=base 1=surface)*/97 int indices[3];98 switch(location){99 case 0:100 indices[0] = 0;101 indices[1] = 1;102 indices[2] = 2;103 break;104 case 1:105 indices[0] = 3;106 indices[1] = 4;107 indices[2] = 5;108 break;109 default:110 _error_("case "<<location<<" not supported");111 }112 113 /*Create new input*/114 for(int i=0;i<3;i++){115 _assert_(indices[i]>=0 && indices[i]<6);116 newvalues[i]=this->values[indices[i]];117 }118 outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);119 }120 121 /*Assign output*/122 return outinput;123 81 } 124 82 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
r17513 r17514 34 34 /*PentaInput management*/ 35 35 int InstanceEnum(); 36 Input* SpawnTriaInput(int location);37 36 Input* SpawnTriaInput(int index1,int index2,int index3); 38 37 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/SegInput.h
r17513 r17514 34 34 /*SegInput management:*/ 35 35 int InstanceEnum(); 36 Input* SpawnTriaInput(int location){_error_("not supported yet");};37 36 Input* SpawnTriaInput(int index1,int index2,int index3){_error_("not supported yet");}; 38 37 Input* SpawnSegInput(int index1,int index2){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h
r17513 r17514 34 34 /*TetraInput management:*/ 35 35 int InstanceEnum(); 36 Input* SpawnTriaInput(int location){_error_("not supported yet");};37 36 Input* SpawnTriaInput(int index1,int index2,int index3); 38 37 Input* SpawnSegInput(int index1,int index2){_error_("not supported yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
r17513 r17514 119 119 120 120 return this->enum_type; 121 122 }123 /*}}}*/124 /*FUNCTION TransientInput::SpawnTriaInput{{{*/125 Input* TransientInput::SpawnTriaInput(int location){126 127 /*output*/128 TransientInput* outinput=NULL;129 130 /*Create new Transientinput (copy of current input)*/131 outinput=new TransientInput();132 outinput->enum_type=this->enum_type;133 outinput->numtimesteps=this->numtimesteps;134 outinput->timesteps=xNew<IssmDouble>(this->numtimesteps);135 xMemCpy(outinput->timesteps,this->timesteps,this->numtimesteps);136 outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(location);137 outinput->parameters=this->parameters;138 139 /*Assign output*/140 return outinput;141 121 142 122 } -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
r17513 r17514 40 40 /*TransientInput management: {{{*/ 41 41 int InstanceEnum(); 42 Input* SpawnTriaInput(int location);43 42 Input* SpawnTriaInput(int index1,int index2,int index3); 44 43 Input* SpawnSegInput(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
r17513 r17514 82 82 /*}}}*/ 83 83 /*FUNCTION TriaInput::SpawnTriaInput{{{*/ 84 Input* TriaInput::SpawnTriaInput(int location){85 86 /*output*/87 TriaInput* outinput=NULL;88 89 /*Create new Tria input (copy of current input)*/90 outinput=new TriaInput(this->enum_type,&this->values[0],this->element_type);91 92 /*Assign output*/93 return outinput;94 95 }96 /*}}}*/97 /*FUNCTION TriaInput::SpawnTriaInput{{{*/98 84 Input* TriaInput::SpawnTriaInput(int index1,int index2,int index3){ 99 85 -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
r17513 r17514 34 34 /*TriaInput management:*/ 35 35 int InstanceEnum(); 36 Input* SpawnTriaInput(int location);37 36 Input* SpawnTriaInput(int index1,int index2,int index3); 38 37 Input* SpawnSegInput(int index1,int index2);
Note:
See TracChangeset
for help on using the changeset viewer.