Changeset 16681


Ignore:
Timestamp:
11/08/13 11:05:25 (11 years ago)
Author:
Mathieu Morlighem
Message:

DEL: removed GetSolutionFromInputs from element

Location:
issm/trunk-jpl/src/c/classes/Elements
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Element.h

    r16675 r16681  
    4848                virtual void    GetDofListVelocity(int** pdoflist,int setenum)=0;
    4949                virtual void    GetDofListPressure(int** pdoflist,int setenum)=0;
    50                 virtual void   GetSolutionFromInputs(Vector<IssmDouble>* solution)=0;
    5150                virtual void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int solutionenum)=0;
    5251                virtual int    GetNodeIndex(Node* node)=0;
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r16675 r16681  
    15271527
    15281528        for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
    1529 }
    1530 /*}}}*/
    1531 /*FUNCTION Penta::GetSolutionFromInputs{{{*/
    1532 void  Penta::GetSolutionFromInputs(Vector<IssmDouble>* solution){
    1533 
    1534         int analysis_type;
    1535 
    1536         /*retrive parameters: */
    1537         parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    1538 
    1539         /*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */
    1540         switch(analysis_type){
    1541         #ifdef _HAVE_STRESSBALANCE_
    1542         case StressbalanceAnalysisEnum:
    1543                 int approximation;
    1544                 inputs->GetInputValue(&approximation,ApproximationEnum);
    1545                 if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
    1546                         GetSolutionFromInputsStressbalanceFS(solution);
    1547                 }
    1548                 else if (approximation==SSAApproximationEnum || approximation==HOApproximationEnum || approximation==SIAApproximationEnum){
    1549                         GetSolutionFromInputsStressbalanceHoriz(solution);
    1550                 }
    1551                 else if (approximation==SSAHOApproximationEnum || approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
    1552                         return; //the elements around will create the solution
    1553                 }
    1554                 break;
    1555         case StressbalanceSIAAnalysisEnum:
    1556                 GetSolutionFromInputsStressbalanceSIA(solution);
    1557                 break;
    1558         case StressbalanceVerticalAnalysisEnum:
    1559                 GetSolutionFromInputsOneDof(solution, VzEnum);
    1560                 break;
    1561         #endif
    1562         #ifdef _HAVE_THERMAL_
    1563         case ThermalAnalysisEnum:
    1564                 GetSolutionFromInputsOneDof(solution, TemperatureEnum);
    1565                 break;
    1566         case EnthalpyAnalysisEnum:
    1567                 GetSolutionFromInputsOneDof(solution, EnthalpyEnum);
    1568                 break;
    1569         #endif
    1570         #ifdef _HAVE_HYDROLOGY_
    1571         case HydrologyDCInefficientAnalysisEnum:
    1572                 GetSolutionFromInputsOneDof(solution, SedimentHeadEnum);
    1573                 break;
    1574         case HydrologyDCEfficientAnalysisEnum:
    1575                 GetSolutionFromInputsOneDof(solution, EplHeadEnum);
    1576                 break;
    1577   #endif
    1578         default:
    1579                 _error_("analysis: " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet");
    1580         }
    15811529}
    15821530/*}}}*/
     
    97059653}
    97069654/*}}}*/
    9707 /*FUNCTION Penta::GetSolutionFromInputsStressbalanceHoriz{{{*/
    9708 void  Penta::GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution){
    9709 
    9710         int         approximation;
    9711         int        *doflist = NULL;
    9712         IssmDouble  vx,vy;
    9713 
    9714         /*Fetch number of nodes and dof for this finite element*/
    9715         int numnodes = this->NumberofNodes();
    9716         int numdof   = numnodes*NDOF2;
    9717 
    9718         /*Get approximation enum and dof list: */
    9719         inputs->GetInputValue(&approximation,ApproximationEnum);
    9720         Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
    9721         Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
    9722 
    9723         /*Fetch dof list and allocate solution vectors*/
    9724         GetDofList(&doflist,approximation,GsetEnum);
    9725         IssmDouble* values = xNew<IssmDouble>(numdof);
    9726 
    9727         /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
    9728         GaussPenta* gauss=new GaussPenta();
    9729         for(int i=0;i<numnodes;i++){
    9730                 gauss->GaussNode(this->element_type,i);
    9731 
    9732                 /*Recover vx and vy*/
    9733                 vx_input->GetInputValue(&vx,gauss);
    9734                 vy_input->GetInputValue(&vy,gauss);
    9735                 values[i*NDOF2+0]=vx;
    9736                 values[i*NDOF2+1]=vy;
    9737         }
    9738 
    9739         /*Add value to global vector*/
    9740         solution->SetValues(numdof,doflist,values,INS_VAL);
    9741 
    9742         /*Free ressources:*/
    9743         delete gauss;
    9744         xDelete<IssmDouble>(values);
    9745         xDelete<int>(doflist);
    9746 }
    9747 /*}}}*/
    9748 /*FUNCTION Penta::GetSolutionFromInputsStressbalanceSIA{{{*/
    9749 void  Penta::GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution){
    9750 
    9751         const int    numdof=NDOF2*NUMVERTICES;
    9752 
    9753         int          i;
    9754         int*         doflist=NULL;
    9755         IssmDouble       vx,vy;
    9756         IssmDouble       values[numdof];
    9757         GaussPenta*  gauss=NULL;
    9758 
    9759         /*Get dof list: */
    9760         GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    9761         Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
    9762         Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
    9763 
    9764         /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
    9765         /*P1 element only for now*/
    9766         gauss=new GaussPenta();
    9767         for(i=0;i<NUMVERTICES;i++){
    9768                 /*Recover vx and vy*/
    9769                 gauss->GaussVertex(i);
    9770                 vx_input->GetInputValue(&vx,gauss);
    9771                 vy_input->GetInputValue(&vy,gauss);
    9772                 values[i*NDOF2+0]=vx;
    9773                 values[i*NDOF2+1]=vy;
    9774         }
    9775 
    9776         /*Add value to global vector*/
    9777         solution->SetValues(numdof,doflist,values,INS_VAL);
    9778 
    9779         /*Free ressources:*/
    9780         delete gauss;
    9781         xDelete<int>(doflist);
    9782 }
    9783 /*}}}*/
    9784 /*FUNCTION Penta::GetSolutionFromInputsStressbalanceFS{{{*/
    9785 void  Penta::GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution){
    9786 
    9787         int*         vdoflist=NULL;
    9788         int*         pdoflist=NULL;
    9789         IssmDouble   vx,vy,vz,p;
    9790         IssmDouble   FSreconditioning;
    9791         GaussPenta  *gauss;
    9792 
    9793         /*Fetch number of nodes and dof for this finite element*/
    9794         int vnumnodes = this->NumberofNodesVelocity();
    9795         int pnumnodes = this->NumberofNodesPressure();
    9796         int vnumdof   = vnumnodes*NDOF3;
    9797         int pnumdof   = pnumnodes*NDOF1;
    9798 
    9799         /*Initialize values*/
    9800         IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
    9801         IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
    9802 
    9803         /*Get dof list: */
    9804         GetDofListVelocity(&vdoflist,GsetEnum);
    9805         GetDofListPressure(&pdoflist,GsetEnum);
    9806         Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
    9807         Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
    9808         Input* vz_input=inputs->GetInput(VzEnum);       _assert_(vz_input);
    9809         Input* p_input =inputs->GetInput(PressureEnum); _assert_(p_input);
    9810 
    9811         this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
    9812 
    9813         /*Ok, we have vx vy vz in values, fill in vx vy vz arrays: */
    9814         gauss = new GaussPenta();
    9815         for(int i=0;i<vnumnodes;i++){
    9816                 gauss->GaussNode(this->VelocityInterpolation(),i);
    9817                 vx_input->GetInputValue(&vx,gauss);
    9818                 vy_input->GetInputValue(&vy,gauss);
    9819                 vz_input->GetInputValue(&vz,gauss);
    9820                 vvalues[i*NDOF3+0]=vx;
    9821                 vvalues[i*NDOF3+1]=vy;
    9822                 vvalues[i*NDOF3+2]=vz;
    9823         }
    9824         for(int i=0;i<pnumnodes;i++){
    9825                 gauss->GaussNode(this->PressureInterpolation(),i);
    9826                 p_input ->GetInputValue(&p ,gauss);
    9827                 pvalues[i]=p/FSreconditioning;
    9828         }
    9829 
    9830         /*Add value to global vector*/
    9831         solution->SetValues(vnumdof,vdoflist,vvalues,INS_VAL);
    9832         solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL);
    9833 
    9834         /*Free ressources:*/
    9835         delete gauss;
    9836         xDelete<int>(pdoflist);
    9837         xDelete<int>(vdoflist);
    9838         xDelete<IssmDouble>(pvalues);
    9839         xDelete<IssmDouble>(vvalues);
    9840 }
    9841 /*}}}*/
    98429655/*FUNCTION Penta::GetL1L2Viscosity{{{*/
    98439656void Penta::GetL1L2Viscosity(IssmDouble* pviscosity,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input,Input* surface_input){
  • issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r16675 r16681  
    9191                void   GetNodesLidList(int* lidlist);
    9292                int    GetNumberOfNodes(void);
    93                 void   GetSolutionFromInputs(Vector<IssmDouble>* solution);
    9493                void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
    9594                IssmDouble GetZcoord(GaussPenta* gauss);
     
    284283                void           InputUpdateFromSolutionStressbalanceVert( IssmDouble* solutiong);
    285284                void           InputUpdateFromSolutionStressbalanceFS( IssmDouble* solutiong);
    286                 void             GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solutiong);
    287                 void             GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solutiong);
    288                 void             GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solutiong);
    289285                ElementVector* CreatePVectorCouplingSSAFS(void);
    290286                ElementVector* CreatePVectorCouplingSSAFSViscous(void);
  • issm/trunk-jpl/src/c/classes/Elements/Seg.h

    r16675 r16681  
    118118                void    ComputeEPLThickness(void){_error_("not implemented yet");};
    119119                #endif
    120                 void        GetSolutionFromInputs(Vector<IssmDouble>* solution){_error_("not implemented yet");};
    121120                void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
    122121                void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");};
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r16675 r16681  
    15031503}
    15041504/*}}}*/
    1505 /*FUNCTION Tria::GetSolutionFromInputs{{{*/
    1506 void  Tria::GetSolutionFromInputs(Vector<IssmDouble>* solution){
    1507 
    1508         /*retrive parameters: */
    1509         int analysis_type;
    1510         parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    1511 
    1512         /*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */
    1513         switch(analysis_type){
    1514         #ifdef _HAVE_STRESSBALANCE_
    1515         case StressbalanceAnalysisEnum:
    1516                 int approximation;
    1517                 inputs->GetInputValue(&approximation,ApproximationEnum);
    1518                 if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
    1519                         GetSolutionFromInputsStressbalanceFS(solution);
    1520                 }
    1521                 else if (approximation==SSAApproximationEnum || approximation==SIAApproximationEnum){
    1522                         GetSolutionFromInputsStressbalanceHoriz(solution);
    1523                 }
    1524                 else{
    1525                         _error_("approximation not supported yet");
    1526                 }
    1527                 break;
    1528         case StressbalanceSIAAnalysisEnum:
    1529                 GetSolutionFromInputsStressbalanceSIA(solution);
    1530                 break;
    1531         #endif
    1532         #ifdef _HAVE_HYDROLOGY_
    1533         case HydrologyShreveAnalysisEnum:
    1534                 GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
    1535                 break;
    1536         case HydrologyDCInefficientAnalysisEnum:
    1537                 GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
    1538                 break;
    1539         case HydrologyDCEfficientAnalysisEnum:
    1540                 GetSolutionFromInputsOneDof(solution,EplHeadEnum);
    1541                 break;
    1542         #endif
    1543         default:
    1544                 _error_("analysis: " << EnumToStringx(analysis_type) << " not supported yet");
    1545         }
    1546 
    1547 }
    1548 /*}}}*/
    15491505/*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{*/
    15501506void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){
     
    43244280        delete gauss;
    43254281        return Ke;
    4326 }
    4327 /*}}}*/
    4328 /*FUNCTION Tria::GetSolutionFromInputsStressbalanceFS{{{*/
    4329 void  Tria::GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution){
    4330 
    4331         int*         vdoflist=NULL;
    4332         int*         pdoflist=NULL;
    4333         IssmDouble   vx,vy,p;
    4334         IssmDouble   FSreconditioning;
    4335         GaussTria   *gauss;
    4336 
    4337         /*Fetch number of nodes and dof for this finite element*/
    4338         int vnumnodes = this->NumberofNodesVelocity();
    4339         int pnumnodes = this->NumberofNodesPressure();
    4340         int vnumdof   = vnumnodes*NDOF2;
    4341         int pnumdof   = pnumnodes*NDOF1;
    4342 
    4343         /*Initialize values*/
    4344         IssmDouble* vvalues = xNew<IssmDouble>(vnumdof);
    4345         IssmDouble* pvalues = xNew<IssmDouble>(pnumdof);
    4346 
    4347         /*Get dof list: */
    4348         GetDofListVelocity(&vdoflist,GsetEnum);
    4349         GetDofListPressure(&pdoflist,GsetEnum);
    4350         Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
    4351         Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
    4352         Input* p_input =inputs->GetInput(PressureEnum); _assert_(p_input);
    4353 
    4354         this->parameters->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
    4355 
    4356         /*Ok, we have vx vy vz in values, fill in vx vy vz arrays: */
    4357         gauss = new GaussTria();
    4358         for(int i=0;i<vnumnodes;i++){
    4359                 gauss->GaussNode(this->VelocityInterpolation(),i);
    4360                 vx_input->GetInputValue(&vx,gauss);
    4361                 vy_input->GetInputValue(&vy,gauss);
    4362                 vvalues[i*NDOF2+0]=vx;
    4363                 vvalues[i*NDOF2+1]=vy;
    4364         }
    4365         for(int i=0;i<pnumnodes;i++){
    4366                 gauss->GaussNode(this->PressureInterpolation(),i);
    4367                 p_input->GetInputValue(&p ,gauss);
    4368                 pvalues[i]=p/FSreconditioning;
    4369         }
    4370 
    4371         /*Add value to global vector*/
    4372         solution->SetValues(vnumdof,vdoflist,vvalues,INS_VAL);
    4373         solution->SetValues(pnumdof,pdoflist,pvalues,INS_VAL);
    4374 
    4375         /*Free ressources:*/
    4376         delete gauss;
    4377         xDelete<int>(pdoflist);
    4378         xDelete<int>(vdoflist);
    4379         xDelete<IssmDouble>(pvalues);
    4380         xDelete<IssmDouble>(vvalues);
    4381 }
    4382 /*}}}*/
    4383 /*FUNCTION Tria::GetSolutionFromInputsStressbalanceHoriz{{{*/
    4384 void  Tria::GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution){
    4385 
    4386         IssmDouble   vx,vy;
    4387         int*         doflist = NULL;
    4388         GaussTria*   gauss   = NULL;
    4389 
    4390         /*Fetch number of nodes and dof for this finite element*/
    4391         int numnodes = this->NumberofNodes();
    4392         int numdof   = numnodes*NDOF2;
    4393 
    4394         /*Fetch dof list and allocate solution vector*/
    4395         GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    4396         IssmDouble* values = xNew<IssmDouble>(numdof);
    4397 
    4398         /*Get inputs*/
    4399         Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
    4400         Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
    4401 
    4402         /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
    4403         gauss=new GaussTria();
    4404         for(int i=0;i<numnodes;i++){
    4405                 gauss->GaussNode(this->element_type,i);
    4406 
    4407                 /*Recover vx and vy*/
    4408                 vx_input->GetInputValue(&vx,gauss);
    4409                 vy_input->GetInputValue(&vy,gauss);
    4410                 values[i*NDOF2+0]=vx;
    4411                 values[i*NDOF2+1]=vy;
    4412         }
    4413 
    4414         solution->SetValues(numdof,doflist,values,INS_VAL);
    4415 
    4416         /*Free ressources:*/
    4417         delete gauss;
    4418         xDelete<IssmDouble>(values);
    4419         xDelete<int>(doflist);
    4420 }
    4421 /*}}}*/
    4422 /*FUNCTION Tria::GetSolutionFromInputsStressbalanceSIA{{{*/
    4423 void  Tria::GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution){
    4424 
    4425         const int    numdof=NDOF2*NUMVERTICES;
    4426 
    4427         int        i;
    4428         IssmDouble     vx,vy;
    4429         IssmDouble     values[numdof];
    4430         int       *doflist = NULL;
    4431         GaussTria *gauss   = NULL;
    4432 
    4433         /*Get dof list: */
    4434         GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    4435 
    4436         /*Get inputs*/
    4437         Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);
    4438         Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);
    4439 
    4440         /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
    4441         /*P1 element only for now*/
    4442         gauss=new GaussTria();
    4443         for(i=0;i<NUMVERTICES;i++){
    4444 
    4445                 gauss->GaussVertex(i);
    4446 
    4447                 /*Recover vx and vy*/
    4448                 vx_input->GetInputValue(&vx,gauss);
    4449                 vy_input->GetInputValue(&vy,gauss);
    4450                 values[i*NDOF2+0]=vx;
    4451                 values[i*NDOF2+1]=vy;
    4452         }
    4453 
    4454         solution->SetValues(numdof,doflist,values,INS_VAL);
    4455 
    4456         /*Free ressources:*/
    4457         delete gauss;
    4458         xDelete<int>(doflist);
    44594282}
    44604283/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r16675 r16681  
    104104                int         NumberofNodesPressure(void);
    105105                bool        NoIceInElement();
    106                 void        GetSolutionFromInputs(Vector<IssmDouble>* solution);
    107106                void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
    108107                void        GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
     
    276275                ElementVector* CreatePVectorStressbalanceFSShelf(void);
    277276                ElementMatrix* CreateJacobianStressbalanceSSA(void);
    278                 void             GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution);
    279                 void             GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution);
    280                 void             GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution);
    281277                IssmDouble     GetYcoord(GaussTria* gauss);
    282278                void             InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution);
Note: See TracChangeset for help on using the changeset viewer.