Changeset 4003


Ignore:
Timestamp:
06/02/10 18:21:45 (15 years ago)
Author:
Eric.Larour
Message:

Spcs and Mpcs now handled on a per analysis basis... getting there

Location:
issm/trunk/src
Files:
22 edited

Legend:

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

    r4002 r4003  
    908908/*}}}*/
    909909/*FUNCTION DataSet::NumberOfRgbs{{{1*/
    910 int   DataSet::NumberOfRgbs(){
     910int   DataSet::NumberOfRgbs(int analysis_type){
    911911
    912912        vector<Object*>::iterator object;
     
    919919                if((*object)->Enum()==RgbEnum){ //we assume uniqueness of all Rgbs, no error checking here.
    920920
    921                         count++;
    922 
     921                        rgb=(Rgb*)(*object);
     922                        if(rgb->InAnalysis(analysis_type))count++
    923923                }
    924924        }
     
    974974}
    975975/*}}}*/
     976/*FUNCTION DataSet::SetupSpcs{{{1*/
     977void   DataSet::SetupSpcs(DataSet* nodes,Vec yg,int analysis_type){
     978
     979        vector<Object*>::iterator object;
     980        Spc* spc=NULL;
     981        Node* node=NULL;
     982
     983        int nodeid;
     984        int dof;
     985        double value;
     986
     987        for ( object=objects.begin() ; object < objects.end(); object++ ){
     988
     989                /*Check this is a single point constraint (spc): */
     990                if((*object)->Enum()==SpcEnum){
     991
     992                        spc=(Spc*)(*object);
     993
     994                        if(spc->InAnalysis(analysis_type)){
     995
     996                                /*Ok, this object is a constraint. Get the nodeid from the node it applies to: */
     997                                nodeid=spc->GetNodeId();
     998                                dof=spc->GetDof();
     999                                value=spc->GetValue();
     1000
     1001                                /*Now, chase through nodes and find the corect node: */
     1002                                node=(Node*)nodes->GetObjectById(NULL,nodeid);
     1003
     1004                                /*Apply constraint: */
     1005                                if(node){ //in case the spc is dealing with a node on another cpu
     1006                                        node->ApplyConstraint(yg,dof,value);
     1007                                }
     1008                        }
     1009
     1010                }
     1011        }
     1012
     1013        /*Assemble yg: */
     1014        VecAssemblyBegin(yg);
     1015        VecAssemblyEnd(yg);
     1016}
     1017/*}}}*/
    9761018/*FUNCTION DataSet::SetupMpcs{{{1*/
    977 void DataSet::SetupMpcs(Mat Rmg,DataSet* nodes){
     1019void DataSet::SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type){
    9781020
    9791021        vector<Object*>::iterator object;
     
    9961038                /*Check this is a single point constraint (spc): */
    9971039                if((*object)->Enum()==RgbEnum){ //we assume uniqueness of all Rgbs, no error checking here.
    998 
    999                         /*we found an rgb, increment counter, so that row index for Rmg is up to date: */
    1000                         count++;
     1040                       
    10011041                        rgb=(Rgb*)(*object);
    1002 
    1003 
    1004                         nodeid1=rgb->GetNodeId1();
    1005                         nodeid2=rgb->GetNodeId2();
    1006                         dof=rgb->GetDof();
    1007 
    1008                         /*For this rgb, find the nodes that go with it: */
    1009                         node1=(Node*)nodes->GetObjectById(NULL,nodeid1);
    1010                         node2=(Node*)nodes->GetObjectById(NULL,nodeid2);
    1011 
    1012                         if ((node1 && !node2) || (!node1 && node2)){
    1013                                 /*we are missing one node, not good!*/
    1014                                 ISSMERROR("%s%p%s%p"," in Rgb, missing one node. node1: ",node1," node2: ",node2);
    1015                         }
    1016 
    1017                         if(!node1 && !node2){
    1018                                 /*That's ok, this Rgb can't find those nodes, so leave them alone. They are probably not on this
    1019                                  * cpu!*/
    1020                         }
    1021                         else{
    1022                                 /*Ok, this cpu owns both nodes. Put dof for node1 into m set, unless it is already there,
    1023                                  * in which case node2 gets into the m set: */
    1024                                 if(node1->DofIsInMSet(dof-1)){
    1025                                         node2->DofInMSet(dof-1);
     1042                        if(rgb->InAnalysis(analysis_type)){
     1043
     1044                                /*we found an rgb, increment counter, so that row index for Rmg is up to date: */
     1045                                count++;
     1046
     1047
     1048                                nodeid1=rgb->GetNodeId1();
     1049                                nodeid2=rgb->GetNodeId2();
     1050                                dof=rgb->GetDof();
     1051
     1052                                /*For this rgb, find the nodes that go with it: */
     1053                                node1=(Node*)nodes->GetObjectById(NULL,nodeid1);
     1054                                node2=(Node*)nodes->GetObjectById(NULL,nodeid2);
     1055
     1056                                if ((node1 && !node2) || (!node1 && node2)){
     1057                                        /*we are missing one node, not good!*/
     1058                                        ISSMERROR("%s%p%s%p"," in Rgb, missing one node. node1: ",node1," node2: ",node2);
     1059                                }
     1060
     1061                                if(!node1 && !node2){
     1062                                        /*That's ok, this Rgb can't find those nodes, so leave them alone. They are probably not on this
     1063                                         * cpu!*/
    10261064                                }
    10271065                                else{
    1028                                         node1->DofInMSet(dof-1);
     1066                                        /*Ok, this cpu owns both nodes. Put dof for node1 into m set, unless it is already there,
     1067                                         * in which case node2 gets into the m set: */
     1068                                        if(node1->DofIsInMSet(dof-1)){
     1069                                                node2->DofInMSet(dof-1);
     1070                                        }
     1071                                        else{
     1072                                                node1->DofInMSet(dof-1);
     1073                                        }
     1074
     1075                                        /*Plug values into Rmg. We essentially want dofs from node1 and node2 to be the
     1076                                         *same: */
     1077                                        dof1=node1->GetDof(dof-1); //matlab indexing
     1078                                        dof2=node2->GetDof(dof-1); //matlab indexing
     1079
     1080                                        MatSetValue(Rmg,count,dof1,1.0,INSERT_VALUES);
     1081                                        MatSetValue(Rmg,count,dof2,-1.0,INSERT_VALUES);
     1082
    10291083                                }
    1030 
    1031                                 /*Plug values into Rmg. We essentially want dofs from node1 and node2 to be the
    1032                                  *same: */
    1033                                 dof1=node1->GetDof(dof-1); //matlab indexing
    1034                                 dof2=node2->GetDof(dof-1); //matlab indexing
    1035 
    1036                                 MatSetValue(Rmg,count,dof1,1.0,INSERT_VALUES);
    1037                                 MatSetValue(Rmg,count,dof2,-1.0,INSERT_VALUES);
    1038 
    10391084                        }
    10401085                }
    10411086        }
    1042 }
    1043 /*}}}*/
    1044 /*FUNCTION DataSet::SetupSpcs{{{1*/
    1045 void   DataSet::SetupSpcs(DataSet* nodes,Vec yg,int analysis_type){
    1046 
    1047         vector<Object*>::iterator object;
    1048         Spc* spc=NULL;
    1049         Node* node=NULL;
    1050 
    1051         int nodeid;
    1052         int dof;
    1053         double value;
    1054 
    1055         for ( object=objects.begin() ; object < objects.end(); object++ ){
    1056 
    1057                 /*Check this is a single point constraint (spc): */
    1058                 if((*object)->Enum()==SpcEnum){
    1059 
    1060                         spc=(Spc*)(*object);
    1061 
    1062                         /*Ok, this object is a constraint. Get the nodeid from the node it applies to: */
    1063                         nodeid=spc->GetNodeId();
    1064                         dof=spc->GetDof();
    1065                         value=spc->GetValue();
    1066 
    1067                         /*Now, chase through nodes and find the corect node: */
    1068                         node=(Node*)nodes->GetObjectById(NULL,nodeid);
    1069 
    1070                         /*Apply constraint: */
    1071                         if(node){ //in case the spc is dealing with a node on another cpu
    1072                                 node->ApplyConstraint(yg,dof,value);
    1073                         }
    1074 
    1075                 }
    1076         }
    1077 
    1078         /*Assemble yg: */
    1079         VecAssemblyBegin(yg);
    1080         VecAssemblyEnd(yg);
    10811087}
    10821088/*}}}*/
  • issm/trunk/src/c/DataSet/DataSet.h

    r4002 r4003  
    6060                int   NumberOfRgbs();
    6161                void  SetupSpcs(DataSet* nodes,Vec yg,int analysis_type);
    62                 void  SetupMpcs(Mat Rmg,DataSet* nodes);
     62                void  SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type);
    6363                void  FlagNodeSets(Vec pv_g, Vec pv_m, Vec pv_n, Vec pv_f, Vec pv_s);
    6464                void  clear();
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp

    r4002 r4003  
    4444
    4545                        if ((int)iomodel->spcvelocity[6*i+0] | (int)iomodel->gridonhutter[i])
    46                                 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcvelocity+6*i+3)/iomodel->yts)); //add count'th spc, on node i+1, setting dof 1 to vx.
     46                                constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcvelocity+6*i+3)/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    4747
    4848                        count++;
    4949                       
    5050                        if ((int)iomodel->spcvelocity[6*i+1] | (int)iomodel->gridonhutter[i])
    51                                 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,*(iomodel->spcvelocity+6*i+4)/iomodel->yts)); //add count'th spc, on node i+1, setting dof 2 to vy
     51                                constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,*(iomodel->spcvelocity+6*i+4)/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
    5252
    5353                        count++;
     
    7373                                node2=(int)*(iomodel->penalties+iomodel->numlayers*i+j)+iomodel->nodecounter;
    7474
    75                                 constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,1));  //add count'th Rgb on dof 1 between node1 and node2
     75                                constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,1,DiagnosticHorizAnalysisEnum));  //add count'th Rgb on dof 1 between node1 and node2
    7676                               
    7777                                count++;
    7878                               
    79                                 constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,2));  //add count'th Rgb on dof 1 between node1 and node2
     79                                constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,2),DiagnosticHorizAnalysisEnum);  //add count'th Rgb on dof 1 between node1 and node2
    8080
    8181                        }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r4002 r4003  
    5656
    5757                /*Create and  add load: */
    58                 loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel));
     58                loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
    5959                count++;
    6060
     
    7979                        if(iomodel->my_elements[(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)]){
    8080
    81                                 loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel));
     81                                loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
    8282                                count++;
    8383                        }
  • issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.cpp

    r3913 r4003  
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
    1111
    12 int MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints){
     12int MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints,int analysis_type){
    1313
    1414        int i;
     
    2828
    2929        /*First, recover number of dofs from nodes: */
    30         numberofdofs=nodes->NumberOfDofs();
     30        numberofdofs=nodes->NumberOfDofs(analysis_type);
    3131
    3232        /*Get number of equations from number of constraints: */
    33         numberofequations=constraints->NumberOfRgbs();
     33        numberofequations=constraints->NumberOfRgbs(analysis_type);
    3434
    3535        if(numberofequations){
     
    4141
    4242                /*Now, go through constraints, and update the nodes and the constraint vector at the same time: */
    43                 constraints->SetupMpcs(Rmg,nodes);
     43                constraints->SetupMpcs(Rmg,nodes,analysis_type);
    4444
    4545                /*Assemble matrix: */
  • issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.h

    r3913 r4003  
    1010
    1111/* local prototypes: */
    12 int             MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints);
     12int             MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints,int analysis_type);
    1313
    1414#endif  /* _MPCNODESX_H */
  • issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp

    r4002 r4003  
    2828
    2929                /*Now, go through constraints, and update the nodes and the constraint vector at the same time: */
    30                 constraints->SetupSpcs(nodes,yg);
     30                constraints->SetupSpcs(nodes,yg,analysis_type);
    3131
    3232                /*Specify numentries: */
  • issm/trunk/src/c/objects/Constraints/Rgb.cpp

    r3775 r4003  
    2525/*}}}1*/
    2626/*FUNCTION Rgb::creation {{{1*/
    27 Rgb::Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof){
     27Rgb::Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof,int rgb_analysis_type){
    2828
    2929        id=rgb_id;
     
    3131        nodeid2=rgb_nodeid2;
    3232        dof=rgb_dof;
     33        analysis_type=rgb_analysis_type;
    3334
    3435        return;
     
    6263        memcpy(marshalled_dataset,&nodeid2,sizeof(nodeid2));marshalled_dataset+=sizeof(nodeid2);
    6364        memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
     65        memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    6466
    6567        *pmarshalled_dataset=marshalled_dataset;
     
    7476                sizeof(nodeid2)+
    7577                sizeof(dof)+
     78                sizeof(analysis_type)+
    7679                sizeof(int); //sizeof(int) for enum type
    7780}
     
    9295        memcpy(&nodeid2,marshalled_dataset,sizeof(nodeid2));marshalled_dataset+=sizeof(nodeid2);
    9396        memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
     97        memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    9498
    9599        /*return: */
     
    113117        printf("   nodeid2: %i\n",nodeid2);
    114118        printf("   dof: %i\n",dof);
     119        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    115120        return;
    116121}               
     
    124129        printf("   nodeid2: %i\n",nodeid2);
    125130        printf("   dof: %i\n",dof);
     131        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    126132        return;
    127133}
     
    160166}
    161167/*}}}1*/
     168/*FUNCTION Rgb::InAnalysis(int analysis_type){{{1*/
     169bool Rgb::InAnalysis(int in_analysis_type){
     170        if (in_analysis_type=this->analysis_type)return true;
     171        else return false;
     172}
     173/*}}}*/
     174
  • issm/trunk/src/c/objects/Constraints/Rgb.h

    r3751 r4003  
    1919                int     nodeid2;
    2020                int dof; /*!component*/
     21                int analysis_type;
    2122
    2223        public:
    2324
    2425                Rgb();
    25                 Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof);
     26                Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof,int analysis_type);
    2627                ~Rgb();
    2728
     
    4950                int    GetDof();
    5051                Object* copy();
     52                bool  InAnalysis(int analysis_type);
     53
    5154
    5255};
  • issm/trunk/src/c/objects/Constraints/Spc.cpp

    r3775 r4003  
    2626/*}}}1*/
    2727/*FUNCTION Spc::creation {{{1*/
    28 Spc::Spc(int spc_sid,int spc_nodeid, int spc_dof,double spc_value){
     28Spc::Spc(int spc_sid,int spc_nodeid, int spc_dof,double spc_value,int spc_analysis_type){
    2929
    3030        sid=spc_sid;
     
    3232        dof=spc_dof;
    3333        value=spc_value;
     34        analysis_type=spc_analysis_type;
    3435
    3536        return;
     
    6364        memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
    6465        memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
     66        memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    6567
    6668        *pmarshalled_dataset=marshalled_dataset;
     
    7173int   Spc::MarshallSize(){
    7274
    73         return sizeof(sid)+sizeof(nodeid)+sizeof(dof)+sizeof(value)+sizeof(int); //sizeof(int) for enum type
     75        return sizeof(sid)
     76                +sizeof(nodeid)
     77                +sizeof(dof)
     78                +sizeof(value)
     79                +sizeof(analysis_type)
     80                +sizeof(int); //sizeof(int) for enum type
    7481}
    7582/*}}}1*/
     
    8996        memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
    9097        memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
     98        memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    9199
    92100        /*return: */
     
    110118        printf("   dof: %i\n",dof);
    111119        printf("   value: %g\n",value);
     120        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    112121        return;
    113122}               
     
    124133        printf("   dof: %i\n",dof);
    125134        printf("   value: %g\n",value);
     135        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    126136        return;
    127137}
     
    159169}
    160170/*}}}1*/
     171/*FUNCTION Spc::InAnalysis(int analysis_type){{{1*/
     172bool Spc::InAnalysis(int in_analysis_type){
     173        if (in_analysis_type=this->analysis_type)return true;
     174        else return false;
     175}
     176/*}}}*/
     177
  • issm/trunk/src/c/objects/Constraints/Spc.h

    r3751 r4003  
    1919                int dof; /*!component*/
    2020                double value; /*value*/
     21                int analysis_type;
    2122
    2223        public:
    2324
    2425                Spc();
    25                 Spc(int sid,int nodeid, int dof,double value);
     26                Spc(int sid,int nodeid, int dof,double value,int analysis_type);
    2627                ~Spc();
    2728
     
    4546                void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
    4647                void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
     48                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
     49                bool    InAnalysis(int analysis_type);
    4750
    48                 void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    4951
    5052
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r3984 r4003  
    232232        penta->InitHookNodes(this->nummodels);
    233233        for(i=0;i<this->nummodels;i++)penta->hnodes[i].copy(&this->hnodes[i]);
    234         penta->hnodes.copy(&this->hnodes);
    235234        penta->hmatice.copy(&this->hmatice);
    236235        penta->hmatpar.copy(&this->hmatpar);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3984 r4003  
    222222        tria->InitHookNodes(this->nummodels);
    223223        for(i=0;i<this->nummodels;i++)tria->hnodes[i].copy(&this->hnodes[i]);
    224         tria->hnodes.copy(&this->hnodes);
    225224        tria->hmatice.copy(&this->hmatice);
    226225        tria->hmatpar.copy(&this->hmatpar);
     
    229228        tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
    230229        for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i];
    231         tria->nodes=(Node**)tria->hnodes.deliverp();
    232230        tria->matice=(Matice*)tria->hmatice.delivers();
    233231        tria->matpar=(Matpar*)tria->hmatpar.delivers();
  • issm/trunk/src/c/objects/FemModel.cpp

    r4002 r4003  
    131131       
    132132        _printf_("   create rigid body constraints:\n");
    133         MpcNodesx( &Rmg[analysis_counter], nodes,constraints);
     133        MpcNodesx( &Rmg[analysis_counter], nodes,constraints,analysis_counter);
    134134       
    135135        _printf_("   create node sets:\n");
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r3863 r4003  
    2626}
    2727/*}}}*/
    28 /*FUNCTION Icefront::Icefront(int id, int* node_ids, int numnodes, int element_id, int matpar_id){{{1*/
    29 Icefront::Icefront(int icefront_id,int* icefront_node_ids, int icefront_numnodes, int icefront_element_id, int icefront_matpar_id):
    30         hnodes(icefront_node_ids,icefront_numnodes),
    31         helement(&icefront_element_id,1),
    32         hmatpar(&icefront_matpar_id,1)
    33 {
    34 
    35         /*all the initialization has been done by the initializer, just fill in the id : */
    36         this->id=icefront_id;
    37         this->parameters=NULL;
    38         this->inputs=new Inputs();
    39 
    40 }
    41 /*}}}*/
    42 /*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* helement, Hook* hmatpar, Parameters* parameters, Inputs* icefront_inputs) {{{1*/
    43 Icefront::Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs):
    44         hnodes(icefront_hnodes),
    45         helement(icefront_helement),
    46         hmatpar(icefront_hmatpar)
    47 {
    48 
    49         /*all the initialization has been done by the initializer, just fill in the id: */
    50         this->id=icefront_id;
    51         if(icefront_inputs){
    52                 this->inputs=(Inputs*)icefront_inputs->Copy();
    53         }
    54         else{
    55                 this->inputs=new Inputs();
    56         }
    57         /*point parameters: */
    58         this->parameters=icefront_parameters;
    59 }
    60 /*}}}*/
    61 /*FUNCTION Icefront::Icefront(int id, int i, IoModel* iomodel) {{{1*/
    62 Icefront::Icefront(int icefront_id,int i, IoModel* iomodel){
     28/*FUNCTION Icefront::Icefront(int id, int i, IoModel* iomodel,int analysis_type) {{{1*/
     29Icefront::Icefront(int icefront_id,int i, IoModel* iomodel,int in_analysis_type){
    6330
    6431        int segment_width;
     
    11481        /*Ok, we have everything to build the object: */
    11582        this->id=icefront_id;
     83        this->analysis_type=in_analysis_type;
    11684
    11785        /*Hooks: */
     
    13098
    13199
     100/*}}}*/
     101/*FUNCTION Icefront::copy {{{1*/
     102Object* Icefront::copy() {
     103       
     104        Icefront* icefront=NULL;
     105
     106        icefront=new Icefront();
     107
     108        /*copy fields: */
     109        icefront->id=this->id;
     110        icefront->analysis=this->analysis;
     111        if(this->inputs){
     112                icefront->inputs=(Inputs*)this->inputs->Copy();
     113        }
     114        else{
     115                icefront->inputs=new Inputs();
     116        }
     117        /*point parameters: */
     118        icefront->parameters=this->parameters;
     119
     120        /*now deal with hooks and objects: */
     121        icefront->hnodes.copy(&this->hnodes);
     122        icefront->helement.copy(&this->helement);
     123        icefront->hmatpar.copy(&this->hmatpar);
     124
     125        /*recover objects: */
     126        icefront->nodes=(Node**)icefront->hnodes.deliverp();
     127        icefront->element=(Element*)icefront->helement.delivers();
     128        icefront->matpar=(Matpar*)icefront->hmatpar.delivers();
     129
     130        return icefront;
     131
     132}
    132133/*}}}*/
    133134/*FUNCTION Icefront::~Icefront() {{{1*/
     
    152153}
    153154/*}}}*/
    154 /*FUNCTION Icefront::copy {{{1*/
    155 Object* Icefront::copy() {
    156         return new Icefront(this->id,&this->hnodes,&this->helement,&this->hmatpar,this->parameters,this->inputs);
    157 }
    158 /*}}}*/
    159155/*FUNCTION Icefront::DeepEcho{{{1*/
    160156void Icefront::DeepEcho(void){
     
    162158        printf("Icefront:\n");
    163159        printf("   id: %i\n",id);
     160        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    164161        hnodes.DeepEcho();
    165162        helement.DeepEcho();
     
    184181
    185182        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
     183        memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    186184
    187185        /*demarshall hooks: */
     
    205203        printf("Icefront:\n");
    206204        printf("   id: %i\n",id);
     205        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    207206        hnodes.Echo();
    208207        helement.Echo();
     
    243242        /*marshall Icefront data: */
    244243        memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
     244        memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
    245245
    246246        /*Marshall hooks: */
     
    266266       
    267267        return sizeof(id)
     268                +sizeof(analysis_type)
    268269                +hnodes.MarshallSize()
    269270                +helement.MarshallSize()
     
    13841385}
    13851386/*}}}*/
     1387/*FUNCTION Icefront::InAnalysis(int analysis_type){{{1*/
     1388bool Icefront::InAnalysis(int in_analysis_type){
     1389        if (in_analysis_type=this->analysis_type)return true;
     1390        else return false;
     1391}
     1392/*}}}*/
     1393
  • issm/trunk/src/c/objects/Loads/Icefront.h

    r3863 r4003  
    2222        public:
    2323                int id;
     24                int analysis_type;
    2425
    2526                /*hooks: */
     
    3435                /*constructors: {{{1*/
    3536                Icefront();
    36                 Icefront(int icefront_id,int* icefront_node_ids, int icefront_numnodes, int icefront_element_id,int icefront_matpar_id);
    37                 Icefront(int icefront_id, Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* parameters, Inputs* icefront_inputs);
    38                 Icefront(int icefront_id,int i, IoModel* iomodel);
     37                Icefront(int icefront_id,int i, IoModel* iomodel,int analysis_type);
    3938                ~Icefront();
     39                Object* copy();
    4040                /*}}}*/
    4141                /*object management: {{{1*/
    4242                void  Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin);
    43                 Object* copy();
    4443                void  DeepEcho();
    4544                void  Demarshall(char** pmarshalled_dataset);
     
    5655                void  UpdateInputsFromConstant(int constant, int name);
    5756                void  UpdateInputsFromConstant(bool constant, int name);
     57                void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type);
     58                bool  InAnalysis(int analysis_type);
    5859
    59                 void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type);
    6060
    6161
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r3913 r4003  
    2727}
    2828/*}}}*/
    29 /*FUNCTION Riftfront::Riftfront(int id, int* node_ids, int matice_id, int matpar_id){{{1*/
    30 Riftfront::Riftfront(int riftfront_id,int* riftfront_node_ids, int riftfront_matpar_id):
    31         hnodes(riftfront_node_ids,2),
    32         hmatpar(&riftfront_matpar_id,1)
    33 {
    34 
    35         /*all the initialization has been done by the initializer, just fill in the id: */
    36         this->id=riftfront_id;
    37         this->parameters=NULL;
    38         this->inputs=new Inputs();
    39 
    40 }
    41 /*}}}*/
    42 /*FUNCTION Riftfront::Riftfront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, Parameters* parameters, Inputs* riftfront_inputs) {{{1*/
    43 Riftfront::Riftfront(int riftfront_id,Hook* riftfront_hnodes, Hook* riftfront_hmatpar, Parameters* riftfront_parameters, Inputs* riftfront_inputs):
    44         hnodes(riftfront_hnodes),
    45         hmatpar(riftfront_hmatpar)
    46 {
    47 
    48         /*all the initialization has been done by the initializer, just fill in the id: */
    49         this->id=riftfront_id;
    50         if(riftfront_inputs){
    51                 this->inputs=(Inputs*)riftfront_inputs->Copy();
    52         }
    53         else{
    54                 this->inputs=new Inputs();
    55         }
    56         /*point parameters: */
    57         this->parameters=riftfront_parameters;
    58 }
    59 /*}}}*/
    60 /*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel){{{1*/
    61 Riftfront::Riftfront(int riftfront_id,int i, IoModel* iomodel){
     29/*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel,int analysis_type){{{1*/
     30Riftfront::Riftfront(int riftfront_id,int i, IoModel* iomodel,int riftfront_analysis_type){
    6231
    6332        /*data: */
     
    8352        /*id: */
    8453        this->id=riftfront_id;
     54        this->analysis_type=riftfront_analysis_type;
    8555
    8656        /*hooks: */
     
    12494}
    12595/*}}}1*/
     96/*FUNCTION Riftfront::copy {{{1*/
     97Object* Riftfront::copy() {
     98       
     99        Riftfront* riftfront=NULL;
     100
     101        riftfront=new Riftfront();
     102
     103        /*copy fields: */
     104        riftfront->id=this->id;
     105        riftfront->analysis=this->analysis;
     106        if(this->inputs){
     107                riftfront->inputs=(Inputs*)this->inputs->Copy();
     108        }
     109        else{
     110                riftfront->inputs=new Inputs();
     111        }
     112        /*point parameters: */
     113        riftfront->parameters=this->parameters;
     114
     115        /*now deal with hooks and objects: */
     116        riftfront->hnodes.copy(&this->hnodes);
     117        riftfront->helement.copy(&this->helement);
     118        riftfront->hmatpar.copy(&this->hmatpar);
     119
     120        /*recover objects: */
     121        riftfront->nodes=(Node**)riftfront->hnodes.deliverp();
     122        riftfront->element=(Element*)riftfront->helement.delivers();
     123        riftfront->matpar=(Matpar*)riftfront->hmatpar.delivers();
     124
     125        return riftfront;
     126
     127}
     128/*}}}*/
    126129/*FUNCTION Riftfront::~Riftfront(){{{1*/
    127130Riftfront::~Riftfront(){
     
    132135
    133136/*Object marshall*/
    134 /*FUNCTION Riftfront::copy {{{1*/
    135 Object* Riftfront::copy() {
    136         return new Riftfront(*this);
    137 }
    138 /*}}}1*/
    139137/*FUNCTION Riftfront::Configure {{{1*/
    140138void  Riftfront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){
     
    155153        printf("Riftfront:\n");
    156154        printf("   id: %i\n",id);
     155        printf("   analysis_type: %s\n",EnumAsString(analysis_type));
    157156        hnodes.DeepEcho();
    158157        hmatpar.DeepEcho();
     
    176175
    177176        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
     177        memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
     178
    178179        memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);
    179180        memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal);
     
    233234
    234235        /*marshall Riftfront data: */
    235         memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
     236        memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
     237        memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
     238
    236239        memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active);
    237240        memcpy(marshalled_dataset,&normal,sizeof(normal));marshalled_dataset+=sizeof(normal);
     
    265268       
    266269        return sizeof(id)
     270                +sizeof(analysis_type)
     271
    267272                +sizeof(active)
    268273                +sizeof(normal)
     
    929934}
    930935/*}}}1*/
     936/*FUNCTION Riftfront::InAnalysis(int analysis_type){{{1*/
     937bool Riftfront::InAnalysis(int in_analysis_type){
     938        if (in_analysis_type=this->analysis_type)return true;
     939        else return false;
     940}
     941/*}}}*/
     942
  • issm/trunk/src/c/objects/Loads/Riftfront.h

    r3751 r4003  
    2222        public:
    2323                int             id;
     24                int     analysis_type;
    2425
    2526                Hook hnodes; //2 nodes
     
    4445                /*constructors,destructors: {{{1*/
    4546                Riftfront();
    46                 Riftfront(int riftfront_id,int* riftfront_node_ids, int riftfront_matpar_id);
    47                 Riftfront(int riftfront_id,Hook* riftfront_hnodes, Hook* riftfront_hmatpar, Parameters* parameters, Inputs* riftfront_inputs);
    48                 Riftfront(int riftfront_id,int i, IoModel* iomodel);
     47                Riftfront(int riftfront_id,int i, IoModel* iomodel,int analysis_type);
    4948                ~Riftfront();
    5049                /*}}}*/
     
    6665                void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
    6766                void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
     67                void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
     68                bool    InAnalysis(int analysis_type);
    6869
    69                 void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
    7070
    7171
  • issm/trunk/src/mex/MpcNodes/MpcNodes.cpp

    r2333 r4003  
    1414        DataSet* nodes=NULL;
    1515        DataSet* constraints=NULL;
     16        int      analysis_type;
    1617
    1718        /* output datasets: */
     
    2728        FetchData(&nodes,NODESIN);
    2829        FetchData(&constraints,CONSTRAINTS);
     30        FetchData(&analysis_type,ANALYSISTYPE);
    2931
    3032        /*!Generate internal degree of freedom numbers: */
    31         MpcNodesx( &Rmg, nodes,constraints);
     33        MpcNodesx( &Rmg, nodes,constraints,analysis_type);
    3234       
    3335        /*write output datasets: */
  • issm/trunk/src/mex/MpcNodes/MpcNodes.h

    r3913 r4003  
    2121#define NODESIN (mxArray*)prhs[0]
    2222#define CONSTRAINTS (mxArray*)prhs[1]
     23#define ANALYSISTYPE (mxArray*)prhs[2]
    2324
    2425/* serial output macros: */
     
    3031#define NLHS  2
    3132#undef NRHS
    32 #define NRHS  2
     33#define NRHS  3
    3334
    3435
  • issm/trunk/src/mex/SpcNodes/SpcNodes.cpp

    r2333 r4003  
    1414        DataSet* nodes=NULL;
    1515        DataSet* constraints=NULL;
     16        int      analysis_type;
    1617
    1718        /* output datasets: */
     
    2728        FetchData(&nodes,NODESIN);
    2829        FetchData(&constraints,CONSTRAINTS);
     30        FetchData(&analysis_type,ANALYSISTYPE);
    2931       
    3032        /*!Generate internal degree of freedom numbers: */
    31         SpcNodesx( &yg, nodes,constraints);
     33        SpcNodesx( &yg, nodes,constraints,analysis_type);
    3234
    3335        /*write output datasets: */
  • issm/trunk/src/mex/SpcNodes/SpcNodes.h

    r3913 r4003  
    2121#define NODESIN (mxArray*)prhs[0]
    2222#define CONSTRAINTS (mxArray*)prhs[1]
     23#define ANALYSISTYPE (mxArray*)prhs[2]
    2324
    2425/* serial output macros: */
     
    3031#define NLHS  2
    3132#undef NRHS
    32 #define NRHS  2
     33#define NRHS  3
    3334
    3435
Note: See TracChangeset for help on using the changeset viewer.