Changeset 3847


Ignore:
Timestamp:
05/19/10 14:14:22 (15 years ago)
Author:
Mathieu Morlighem
Message:

Fixed spawn tria

Location:
issm/trunk/src/c
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/DataSet.cpp

    r3821 r3847  
    364364       
    365365        return dataset;
    366 }
    367 /*}}}*/
    368 /*FUNCTION DataSet::Spawn{{{1*/
    369 DataSet* DataSet::Spawn(int* indices, int num){
    370         ISSMERROR(" not supported yet!");
    371366}
    372367/*}}}*/
  • issm/trunk/src/c/DataSet/DataSet.h

    r3830 r3847  
    101101                void  UpdateVertexPositions(double* thickness,double* bed);
    102102                void  OutputRifts(Vec riftproperties);
    103                 DataSet* Spawn(int* indices, int num);
    104103                /*}}}*/
    105104
     
    129128                /*numerics: {{{1*/
    130129                int  AddInput(Input* in_input);
     130                Inputs* SpawnTriaInputs(int* indices);
    131131               
    132132                void GetParameterValue(bool* pvalue,int enum_type);
  • issm/trunk/src/c/DataSet/Inputs.cpp

    r3830 r3847  
    413413}
    414414/*}}}*/
     415/*FUNCTION Inputs::SpawnTriaInputs{{{1*/
     416Inputs* Inputs::SpawnTriaInputs(int* indices){
     417
     418        /*Intermediary*/
     419        vector<Object*>::iterator object;
     420        Input* inputin=NULL;
     421        Input* inputout=NULL;
     422
     423        /*Output*/
     424        Inputs* newinputs=new Inputs();
     425
     426        /*Go through inputs and call Spawn function*/
     427        for ( object=objects.begin() ; object < objects.end(); object++ ){
     428
     429                /*Create new input*/
     430                inputin=(Input*)(*object);
     431                inputout=inputin->SpawnTriaInput(indices);
     432
     433                /*Add input to new inputs*/
     434                newinputs->AddObject(inputout);
     435        }
     436
     437        /*Assign output pointer*/
     438        return newinputs;
     439}
     440/*}}}*/
  • issm/trunk/src/c/objects/Elements/Beam.cpp

    r3821 r3847  
    375375/*}}}*/
    376376/*FUNCTION Beam::CreateKMatrix{{{1*/
    377 
    378377void  Beam::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
    379378
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r3840 r3847  
    392392        tria_hmatpar=this->hmatpar.Spawn(&zero,1);
    393393        tria_parameters=this->parameters;
    394         tria_inputs=(Inputs*)this->inputs->Spawn(indices,3);
     394        tria_inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);
    395395       
    396396        tria=new Tria();
     
    412412        delete tria_hmatice;
    413413        delete tria_hmatpar;
    414         delete tria_inputs;
    415414
    416415        return tria;
     
    817816/*}}}*/
    818817/*FUNCTION CreateKMatrix {{{1*/
    819 
    820818void  Penta::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
     819
     820        /*if debugging mode, check that all pointers exist*/
     821        ISSMASSERT(this->nodes && this->matice && this->matpar && this->neighbors && this->parameters && this->inputs);
    821822
    822823        /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
     
    933934/*FUNCTION CreateKMatrixDiagnosticHoriz {{{1*/
    934935void Penta::CreateKMatrixDiagnosticHoriz( Mat Kgg,  int analysis_type,int sub_analysis_type){
    935 
    936936
    937937        /* local declarations */
     
    18801880/*FUNCTION CreatePVector {{{1*/
    18811881void  Penta::CreatePVector(Vec pg,  int analysis_type,int sub_analysis_type){
     1882
     1883        /*if debugging mode, check that all pointers exist*/
     1884        ISSMASSERT(this->nodes && this->matice && this->matpar && this->neighbors && this->parameters && this->inputs);
    18821885
    18831886        /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3840 r3847  
    273273        printf("Tria:\n");
    274274        printf("   id: %i\n",id);
    275         nodes[0]->DeepEcho();
    276         nodes[1]->DeepEcho();
    277         nodes[2]->DeepEcho();
    278         matice->DeepEcho();
    279         matpar->DeepEcho();
     275        if(nodes){
     276                nodes[0]->DeepEcho();
     277                nodes[1]->DeepEcho();
     278                nodes[2]->DeepEcho();
     279        }
     280        else printf("nodes = NULL\n");
     281
     282        if (matice) matice->DeepEcho();
     283        else printf("matice = NULL\n");
     284
     285        if (matpar) matpar->DeepEcho();
     286        else printf("matpar = NULL\n");
     287
    280288        printf("   parameters\n");
    281         parameters->DeepEcho();
     289        if (parameters) parameters->DeepEcho();
     290        else printf("parameters = NULL\n");
     291
    282292        printf("   inputs\n");
    283         inputs->DeepEcho();
     293        if (inputs) inputs->DeepEcho();
     294        else printf("inputs=NULL\n");
    284295       
    285296        return;
     
    696707/*}}}*/
    697708/*FUNCTION Tria::CreateKMatrix {{{1*/
    698 
    699709void  Tria::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
     710
     711        /*if debugging mode, check that all pointers exist*/
     712        ISSMASSERT(this->nodes && this->matice && this->matpar && this->parameters && this->inputs);
    700713
    701714        /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
     
    20812094void  Tria::CreatePVector(Vec pg,int analysis_type,int sub_analysis_type){
    20822095       
     2096        /*if debugging mode, check that all pointers exist*/
     2097        ISSMASSERT(this->nodes && this->matice && this->matpar && this->parameters && this->inputs);
     2098
    20832099        /*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
    20842100        if (analysis_type==ControlAnalysisEnum){
  • issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp

    r3830 r3847  
    4949
    5050        printf("BeamVertexInput:\n");
    51         printf("   enum: %i\n",this->enum_type);
    52         printf("   %g|%g\n",this->values[0],this->values[1]);
     51        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     52        printf("   values: [%g %g]\n",this->values[0],this->values[1]);
    5353}
    5454/*}}}*/
     
    130130}
    131131/*}}}*/
     132/*FUNCTION BeamVertexInput::SpawnTriaInput{{{1*/
     133Input* BeamVertexInput::SpawnTriaInput(int* indices){
     134
     135        ISSMERROR("Cannot spaw a Tria from a Beam");
     136
     137}
     138/*}}}*/
    132139
    133140/*Object functions*/
  • issm/trunk/src/c/objects/Inputs/BeamVertexInput.h

    r3830 r3847  
    3838                Object* copy();
    3939                int   EnumType();
    40                 void    UpdateInputsFromVector(double* vector, int name, int type){ISSMERROR("Not implemented yet!");}
    41                 void    UpdateInputsFromVector(int* vector, int name, int type){ISSMERROR("Not implemented yet!");}
    42                 void    UpdateInputsFromVector(bool* vector, int name, int type){ISSMERROR("Not implemented yet!");}
    43                 void    UpdateInputsFromConstant(double constant, int name){ISSMERROR("Not implemented yet!");}
    44                 void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
    45                 void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
     40                void  UpdateInputsFromVector(double* vector, int name, int type){ISSMERROR("Not implemented yet!");}
     41                void  UpdateInputsFromVector(int* vector, int name, int type){ISSMERROR("Not implemented yet!");}
     42                void  UpdateInputsFromVector(bool* vector, int name, int type){ISSMERROR("Not implemented yet!");}
     43                void  UpdateInputsFromConstant(double constant, int name){ISSMERROR("Not implemented yet!");}
     44                void  UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
     45                void  UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
    4646
    47                 void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
     47                void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4848
    49 
     49                Input* SpawnTriaInput(int* indices);
    5050                /*}}}*/
    5151                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/BoolInput.cpp

    r3808 r3847  
    4848
    4949        printf("BoolInput:\n");
    50         printf("   enum: %i\n",this->enum_type);
    51         printf("   %s\n",value?"true":"false");
     50        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     51        printf("   value: %s\n",value?"true":"false");
    5252}
    5353/*}}}*/
     
    129129}
    130130/*}}}*/
     131/*FUNCTION BoolInput::SpawnTriaInput{{{1*/
     132Input* BoolInput::SpawnTriaInput(int* indices){
     133
     134                /*output*/
     135                BoolInput* outinput=new BoolInput();
     136
     137                /*only copy current value*/
     138                outinput->enum_type=this->enum_type;
     139                outinput->value=this->value;
     140
     141                /*Assign output*/
     142                return outinput;
     143
     144}
     145/*}}}*/
    131146
    132147/*Object functions*/
  • issm/trunk/src/c/objects/Inputs/BoolInput.h

    r3830 r3847  
    4747                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4848
    49 
     49                Input* SpawnTriaInput(int* indices);
    5050                /*}}}*/
    5151                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/DoubleInput.cpp

    r3808 r3847  
    4848
    4949        printf("DoubleInput:\n");
    50         printf("   enum: %i\n",this->enum_type);
    51         printf("   %g\n",this->value);
     50        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     51        printf("   value: %g\n",this->value);
    5252}
    5353/*}}}*/
     
    129129}
    130130/*}}}*/
     131/*FUNCTION DoubleInput::SpawnTriaInput{{{1*/
     132Input* DoubleInput::SpawnTriaInput(int* indices){
     133
     134        /*output*/
     135        DoubleInput* outinput=new DoubleInput();
     136
     137        /*only copy current value*/
     138        outinput->enum_type=this->enum_type;
     139        outinput->value=this->value;
     140
     141        /*Assign output*/
     142        return outinput;
     143
     144}
     145/*}}}*/
    131146
    132147/*Object functions*/
  • issm/trunk/src/c/objects/Inputs/DoubleInput.h

    r3830 r3847  
    4747                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4848
    49 
     49                Input* SpawnTriaInput(int* indices);
    5050                /*}}}*/
    5151                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/Input.h

    r3830 r3847  
    4242                virtual void GetVzStrainRate3d(double* epsilonvz,double* xyz_list, double* gauss,int formulation_enum=StokesFormulationEnum)=0;
    4343                virtual void ChangeEnum(int newenumtype)=0;
     44                virtual Input* SpawnTriaInput(int* indices)=0;
    4445                /*}}}*/
    4546
  • issm/trunk/src/c/objects/Inputs/IntInput.cpp

    r3808 r3847  
    4848
    4949        printf("IntInput:\n");
    50         printf("   enum: %i\n",this->enum_type);
    51         printf("   %i\n",this->value);
     50        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     51        printf("   value: %i\n",this->value);
    5252}
    5353/*}}}*/
     
    129129}
    130130/*}}}*/
     131/*FUNCTION IntInput::SpawnTriaInput{{{1*/
     132Input* IntInput::SpawnTriaInput(int* indices){
     133
     134        /*output*/
     135        IntInput* outinput=new IntInput();
     136
     137        /*only copy current value*/
     138        outinput->enum_type=this->enum_type;
     139        outinput->value=this->value;
     140
     141        /*Assign output*/
     142        return outinput;
     143}
     144/*}}}*/
    131145
    132146/*Object functions*/
  • issm/trunk/src/c/objects/Inputs/IntInput.h

    r3830 r3847  
    4747                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4848
    49 
     49                Input* SpawnTriaInput(int* indices);
    5050                /*}}}*/
    5151                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp

    r3840 r3847  
    2323}
    2424/*}}}*/
    25 /*FUNCTION PentaVertexInput::PentaVertexInput(double* values){{{1*/
     25/*FUNCTION PentaVertexInput::PentaVertexInput(int in_enum_type,double* values){{{1*/
    2626PentaVertexInput::PentaVertexInput(int in_enum_type,double* in_values){
    2727
     
    5353
    5454        printf("PentaVertexInput:\n");
    55         printf("   enum: %i\n",this->enum_type);
    56         printf("   %g|%g|%g|%g|%g|%g\n",this->values[0],this->values[1],this->values[2],this->values[3],this->values[4],this->values[5]);
     55        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     56        printf("   values: [%g %g %g %g %g %g]\n",this->values[0],this->values[1],this->values[2],this->values[3],this->values[4],this->values[5]);
    5757}
    5858/*}}}*/
     
    132132        extern int my_rank;
    133133        return my_rank;
     134}
     135/*}}}*/
     136/*FUNCTION PentaVertexInput::SpawnTriaInput{{{1*/
     137Input* PentaVertexInput::SpawnTriaInput(int* indices){
     138
     139        /*output*/
     140        TriaVertexInput* outinput=NULL;
     141        double newvalues[3];
     142
     143        /*Loop over the new indices*/
     144        for(int i=0;i<3;i++){
     145
     146                /*Check index value*/
     147                ISSMASSERT(indices[i]>=0 && indices[i]<6);
     148
     149                /*Assign value to new input*/
     150                newvalues[i]=this->values[indices[i]];
     151        }
     152
     153        /*Create new Tria input*/
     154        outinput=new TriaVertexInput(this->enum_type,&newvalues[0]);
     155
     156        /*Assign output*/
     157        return outinput;
     158
    134159}
    135160/*}}}*/
  • issm/trunk/src/c/objects/Inputs/PentaVertexInput.h

    r3840 r3847  
    4646                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4747
    48 
     48                Input* SpawnTriaInput(int* indices);
    4949                /*}}}*/
    5050                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp

    r3830 r3847  
    4848
    4949        printf("SingVertexInput:\n");
    50         printf("   enum: %i\n",this->enum_type);
    51         printf("   %g\n",this->value);
     50        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     51        printf("   value: %g\n",this->value);
    5252}
    5353/*}}}*/
     
    129129}
    130130/*}}}*/
     131/*FUNCTION SingVertexInput::SpawnTriaInput{{{1*/
     132Input* SingVertexInput::SpawnTriaInput(int* indices){
     133
     134        ISSMERROR("Cannot spaw a Tria from a Sing");
     135
     136}
     137/*}}}*/
    131138
    132139/*Object functions*/
  • issm/trunk/src/c/objects/Inputs/SingVertexInput.h

    r3830 r3847  
    4646                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4747
    48 
     48                Input* SpawnTriaInput(int* indices);
    4949                /*}}}*/
    5050                /*numerics: {{{1*/
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp

    r3840 r3847  
    2323}
    2424/*}}}*/
    25 /*FUNCTION TriaVertexInput::TriaVertexInput(double* values){{{1*/
     25/*FUNCTION TriaVertexInput::TriaVertexInput(int in_enum_type,double* values){{{1*/
    2626TriaVertexInput::TriaVertexInput(int in_enum_type,double* in_values){
    2727
     
    5050
    5151        printf("TriaVertexInput:\n");
    52         printf("   enum: %i\n",this->enum_type);
    53         printf("   %g|%g|%g\n",this->values[0],this->values[1],this->values[2]);
     52        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
     53        printf("   values: [%g %g %g]\n",this->values[0],this->values[1],this->values[2]);
    5454}
    5555/*}}}*/
     
    129129        extern int my_rank;
    130130        return my_rank;
     131}
     132/*}}}*/
     133/*FUNCTION TriaVertexInput::SpawnTriaInput{{{1*/
     134Input* TriaVertexInput::SpawnTriaInput(int* indices){
     135
     136        /*output*/
     137        TriaVertexInput* outinput=NULL;
     138
     139        /*Create new Tria input (copy of current input)*/
     140        outinput=new TriaVertexInput(this->enum_type,&this->values[0]);
     141
     142        /*Assign output*/
     143        return outinput;
     144
     145
    131146}
    132147/*}}}*/
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.h

    r3830 r3847  
    4747                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4848
    49 
     49                Input* SpawnTriaInput(int* indices);
    5050                /*}}}*/
    5151                /*numerics: {{{1*/
Note: See TracChangeset for help on using the changeset viewer.