Ignore:
Timestamp:
04/23/10 11:09:28 (15 years ago)
Author:
Eric.Larour
Message:

First new interface with new inputs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Penta.cpp

    r3599 r3612  
    266266}
    267267/*}}}*/
    268 /*FUNCTION UpdateFromInputs {{{1*/
    269 void  Penta::UpdateFromInputs(void* vinputs){
    270 
    271         int     dofs[1]={0};
    272         double  temperature_list[6];
    273         double  temperature_average;
    274         double  B_list[6];
    275         double  B_average;
    276 
    277         /*dynamic objects pointed to by hooks: */
    278         Node**  nodes=NULL;
    279         Matice* matice=NULL;
    280 
    281         ParameterInputs* inputs=NULL;
    282 
    283         /*If on water, skip: */
    284         if(this->properties.onwater)return;
    285 
    286         /*recover objects from hooks: */
    287         nodes=(Node**)hnodes.deliverp();
    288         matice=(Matice*)hmatice.delivers();
    289 
    290         /*recover pointers: */
    291         inputs=(ParameterInputs*)vinputs;
    292 
    293         /*Update internal data if inputs holds new values: */
    294         if (this->properties.h)              inputs->Recover("thickness",&this->properties.h[0],1,dofs,6,(void**)nodes);
    295         if (this->properties.s)              inputs->Recover("surface",&this->properties.s[0],1,dofs,6,(void**)nodes);
    296         if (this->properties.b)              inputs->Recover("bed",&this->properties.b[0],1,dofs,6,(void**)nodes);
    297         if (this->properties.k)              inputs->Recover("drag",&this->properties.k[0],1,dofs,6,(void**)nodes);
    298         if (this->properties.melting)        inputs->Recover("melting",&this->properties.melting[0],1,dofs,6,(void**)nodes);
    299         if (this->properties.accumulation)   inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,6,(void**)nodes);
    300         if (this->properties.geothermalflux) inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,6,(void**)nodes);
    301 
    302         //Update material if necessary
    303         if(inputs->Recover("temperature",&temperature_list[0],1,dofs,6,(void**)nodes)){
    304                 if(matice && !this->properties.collapse){
    305                         //B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
    306                         //                      +Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
    307                         temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
    308                         B_average=Paterson(temperature_average);
    309                         matice->SetB(B_average);
    310                 }
    311         }
    312 
    313         if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){
    314                 if(matice && this->properties.collapse){
    315                         temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
    316                         B_average=Paterson(temperature_average);
    317                         //B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
    318                         //                      +Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
    319                         matice->SetB(B_average);
    320                 }
    321         }
    322 
    323         if(inputs->Recover("B",&B_list[0],1,dofs,6,(void**)nodes)){
    324                 if(matice){
    325                         B_average=(B_list[0]+B_list[1]+B_list[2]+B_list[3]+B_list[4]+B_list[5])/6.0;
    326                         matice->SetB(B_average);
    327                 }
    328         }
    329 
    330 }
    331 /*}}}*/
    332268/*FUNCTION UpdateFromDakota {{{1*/
    333269void  Penta::UpdateFromDakota(void* vinputs){
     
    345281/*Object functions*/
    346282/*FUNCTION ComputeBasalStress {{{1*/
    347 void  Penta::ComputeBasalStress(Vec sigma_b,void* vinputs,int analysis_type,int sub_analysis_type){
     283void  Penta::ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type){
    348284
    349285        int i,j;
     
    477413/*}}}*/
    478414/*FUNCTION ComputePressure {{{1*/
    479 void  Penta::ComputePressure(Vec pg,void* vinputs,int analysis_type,int sub_analysis_type){
     415void  Penta::ComputePressure(Vec pg,int analysis_type,int sub_analysis_type){
    480416
    481417        int i;
     
    519455/*}}}*/
    520456/*FUNCTION ComputeStrainRate {{{1*/
    521 void  Penta::ComputeStrainRate(Vec eps,void* vinputs,int analysis_type,int sub_analysis_type){
     457void  Penta::ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type){
    522458
    523459        ISSMERROR("Not implemented yet");
     
    526462/*}}}*/
    527463/*FUNCTION CostFunction {{{1*/
    528 double Penta::CostFunction(void* inputs,int analysis_type,int sub_analysis_type){
     464double Penta::CostFunction(int analysis_type,int sub_analysis_type){
    529465
    530466        double J;
     
    560496/*FUNCTION CreateKMatrix {{{1*/
    561497
    562 void  Penta::CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
     498void  Penta::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
    563499
    564500        /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
     
    608544/*}}}*/
    609545/*FUNCTION CreateKMatrixDiagnosticHoriz {{{1*/
    610 void Penta::CreateKMatrixDiagnosticHoriz( Mat Kgg, void* vinputs, int analysis_type,int sub_analysis_type){
     546void Penta::CreateKMatrixDiagnosticHoriz( Mat Kgg, int analysis_type,int sub_analysis_type){
    611547
    612548
     
    844780/*}}}*/
    845781/*FUNCTION CreateKMatrixDiagnosticStokes {{{1*/
    846 void Penta::CreateKMatrixDiagnosticStokes( Mat Kgg, void* vinputs, int analysis_type,int sub_analysis_type){
     782void Penta::CreateKMatrixDiagnosticStokes( Mat Kgg, int analysis_type,int sub_analysis_type){
    847783
    848784        int i,j;
     
    11391075/*}}}*/
    11401076/*FUNCTION CreateKMatrixDiagnosticVert {{{1*/
    1141 void Penta::CreateKMatrixDiagnosticVert( Mat Kgg, void* vinputs, int analysis_type,int sub_analysis_type){
     1077void Penta::CreateKMatrixDiagnosticVert( Mat Kgg, int analysis_type,int sub_analysis_type){
    11421078
    11431079        /* local declarations */
     
    12751211/*}}}*/
    12761212/*FUNCTION CreateKMatrixMelting {{{1*/
    1277 void  Penta::CreateKMatrixMelting(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
     1213void  Penta::CreateKMatrixMelting(Mat Kgg,int analysis_type,int sub_analysis_type){
    12781214
    12791215        Tria* tria=NULL;
     
    12961232/*FUNCTION CreateKMatrixPrognostic {{{1*/
    12971233
    1298 void  Penta::CreateKMatrixPrognostic(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
     1234void  Penta::CreateKMatrixPrognostic(Mat Kgg,int analysis_type,int sub_analysis_type){
    12991235
    13001236        /*Collapsed formulation: */
     
    13171253/*FUNCTION CreateKMatrixSlopeCompute {{{1*/
    13181254
    1319 void  Penta::CreateKMatrixSlopeCompute(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
     1255void  Penta::CreateKMatrixSlopeCompute(Mat Kgg,int analysis_type,int sub_analysis_type){
    13201256
    13211257        /*Collapsed formulation: */
     
    13371273/*}}}*/
    13381274/*FUNCTION CreateKMatrixThermal {{{1*/
    1339 void  Penta::CreateKMatrixThermal(Mat Kgg,void* vinputs,int analysis_type,int sub_analysis_type){
     1275void  Penta::CreateKMatrixThermal(Mat Kgg,int analysis_type,int sub_analysis_type){
    13401276
    13411277        /* local declarations */
     
    16001536/*}}}*/
    16011537/*FUNCTION CreatePVector {{{1*/
    1602 void  Penta::CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
     1538void  Penta::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){
    16031539
    16041540        /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
     
    16461582/*}}}*/
    16471583/*FUNCTION CreatePVectorDiagnosticHoriz {{{1*/
    1648 void Penta::CreatePVectorDiagnosticHoriz( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){
     1584void Penta::CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type){
    16491585
    16501586        int i,j;
     
    18011737/*}}}*/
    18021738/*FUNCTION CreatePVectorDiagnosticStokes {{{1*/
    1803 void Penta::CreatePVectorDiagnosticStokes( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){
     1739void Penta::CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type){
    18041740
    18051741        /*indexing: */
     
    20511987/*}}}*/
    20521988/*FUNCTION CreatePVectorDiagnosticVert {{{1*/
    2053 void  Penta::CreatePVectorDiagnosticVert( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){
     1989void  Penta::CreatePVectorDiagnosticVert( Vec pg, int analysis_type,int sub_analysis_type){
    20541990
    20551991        int i;
     
    21902126/*}}}*/
    21912127/*FUNCTION CreatePVectorMelting {{{1*/
    2192 void Penta::CreatePVectorMelting( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){
     2128void Penta::CreatePVectorMelting( Vec pg, int analysis_type,int sub_analysis_type){
    21932129        return;
    21942130}
     
    21962132/*FUNCTION CreatePVectorPrognostic {{{1*/
    21972133
    2198 void Penta::CreatePVectorPrognostic( Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
     2134void Penta::CreatePVectorPrognostic( Vec pg, int analysis_type,int sub_analysis_type){
    21992135
    22002136        /*Collapsed formulation: */
     
    22162152/*FUNCTION CreatePVectorSlopeCompute {{{1*/
    22172153
    2218 void Penta::CreatePVectorSlopeCompute( Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
     2154void Penta::CreatePVectorSlopeCompute( Vec pg, int analysis_type,int sub_analysis_type){
    22192155
    22202156        /*Collapsed formulation: */
     
    22352171/*}}}*/
    22362172/*FUNCTION CreatePVectorThermal {{{1*/
    2237 void Penta::CreatePVectorThermal( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){
     2173void Penta::CreatePVectorThermal( Vec pg, int analysis_type,int sub_analysis_type){
    22382174
    22392175
     
    24382374/*}}}*/
    24392375/*FUNCTION Du {{{1*/
    2440 void  Penta::Du(Vec du_g,void* inputs,int analysis_type,int sub_analysis_type){
     2376void  Penta::Du(Vec du_g,int analysis_type,int sub_analysis_type){
    24412377
    24422378        int i;
     
    36473583/*}}}*/
    36483584/*FUNCTION GetOnBed {{{1*/
    3649 int Penta::GetOnBed(){
     3585bool Penta::GetOnBed(){
    36503586        return this->properties.onbed;
    36513587}
     
    37923728/*}}}*/
    37933729/*FUNCTION Gradj {{{1*/
    3794 void  Penta::Gradj(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type,char* control_type){
     3730void  Penta::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type){
    37953731
    37963732        /*If on water, skip grad (=0): */
     
    38073743/*}}}*/
    38083744/*FUNCTION GradjDrag {{{1*/
    3809 void  Penta::GradjDrag(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type){
     3745void  Penta::GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type){
    38103746
    38113747        Tria* tria=NULL;
     
    38403776/*}}}*/
    38413777/*FUNCTION GradjB {{{1*/
    3842 void  Penta::GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type){
     3778void  Penta::GradjB(Vec grad_g,int analysis_type,int sub_analysis_type){
    38433779
    38443780        Tria* tria=NULL;
     
    38733809/*}}}*/
    38743810/*FUNCTION Misfit {{{1*/
    3875 double Penta::Misfit(void* inputs,int analysis_type,int sub_analysis_type){
     3811double Penta::Misfit(int analysis_type,int sub_analysis_type){
    38763812
    38773813        double J;
     
    40063942/*}}}1*/
    40073943/*FUNCTION SurfaceArea {{{1*/
    4008 double Penta::SurfaceArea(void* inputs,int analysis_type,int sub_analysis_type){
     3944double Penta::SurfaceArea(int analysis_type,int sub_analysis_type){
    40093945
    40103946        double S;
Note: See TracChangeset for help on using the changeset viewer.