Changeset 18929


Ignore:
Timestamp:
12/04/14 09:50:36 (10 years ago)
Author:
seroussi
Message:

CHG: some ordering

Location:
issm/trunk-jpl/src/c/analyses
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/Analysis.h

    r18057 r18929  
    2626
    2727                /*Model processing*/
    28                 virtual int  DofsPerNode(int** doflist,int domaintype,int approximation)=0;
    29                 virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0;
    30                 virtual void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type)=0;
    31                 virtual void CreateNodes(Nodes* nodes,IoModel* iomodel)=0;
    3228                virtual void CreateConstraints(Constraints* constraints,IoModel* iomodel)=0;
    3329                virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0;
     30                virtual void CreateNodes(Nodes* nodes,IoModel* iomodel)=0;
     31                virtual int  DofsPerNode(int** doflist,int domaintype,int approximation)=0;
     32                virtual void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type)=0;
     33                virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0;
    3434
    3535                /*Finite element Analysis*/
     
    3939                virtual ElementMatrix* CreateKMatrix(Element* element)=0;
    4040                virtual ElementVector* CreatePVector(Element* element)=0;
    41                 virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
    42                 virtual void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index)=0;
    43                 virtual void InputUpdateFromSolution(IssmDouble* solution,Element* element)=0;
    44                 virtual void UpdateConstraints(FemModel* femmodel)=0;
     41                virtual void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;
     42                virtual void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index)=0;
     43                virtual void           InputUpdateFromSolution(IssmDouble* solution,Element* element)=0;
     44                virtual void           UpdateConstraints(FemModel* femmodel)=0;
    4545};
    4646#endif
  • issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp

    r18057 r18929  
    66
    77/*Model processing*/
     8void DepthAverageAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9}/*}}}*/
     10void DepthAverageAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     11}/*}}}*/
     12void DepthAverageAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     13
     14        ::CreateNodes(nodes,iomodel,DepthAverageAnalysisEnum,P1Enum);
     15
     16}/*}}}*/
    817int  DepthAverageAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    918        return 1;
    10 }/*}}}*/
    11 void DepthAverageAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    1219}/*}}}*/
    1320void DepthAverageAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     
    2633        }
    2734}/*}}}*/
    28 void DepthAverageAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    29 
    30         ::CreateNodes(nodes,iomodel,DepthAverageAnalysisEnum,P1Enum);
    31 
    32 }/*}}}*/
    33 void DepthAverageAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    34 }/*}}}*/
    35 void DepthAverageAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     35void DepthAverageAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    3636}/*}}}*/
    3737
     
    137137        return pe;
    138138}/*}}}*/
    139 void DepthAverageAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     139void           DepthAverageAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    140140        /*      Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
    141141                where hi is the interpolation function for node i.*/
     
    157157}
    158158/*}}}*/
    159 void DepthAverageAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     159void           DepthAverageAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    160160           _error_("not implemented yet");
    161161}/*}}}*/
    162 void DepthAverageAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     162void           DepthAverageAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    163163        _error_("Not implemented yet");
    164164}/*}}}*/
    165 void DepthAverageAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     165void           DepthAverageAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    166166
    167167        int inputenum;
     
    169169        element->InputUpdateFromSolutionOneDof(solution,inputenum);
    170170}/*}}}*/
    171 void DepthAverageAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     171void           DepthAverageAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    172172        /*Default, do nothing*/
    173173        return;
  • issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.h

    r18057 r18929  
    1313        public:
    1414                /*Model processing*/
    15                 int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16                 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17                 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18                 void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915                void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016                void CreateLoads(Loads* loads, IoModel* iomodel);
     17                void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18                int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19                void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20                void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222                /*Finite element Analysis*/
     
    2626                ElementMatrix* CreateKMatrix(Element* element);
    2727                ElementVector* CreatePVector(Element* element);
    28                 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    29                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    30                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    31                 void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    32                 void UpdateConstraints(FemModel* femmodel);
     28                void           GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     29                void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     30                void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     31                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     32                void           UpdateConstraints(FemModel* femmodel);
    3333};
    3434#endif
  • issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp

    r18521 r18929  
    66#include "../solutionsequences/solutionsequences.h"
    77
    8 int ExtrapolationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
     8void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9        // do nothing for now
     10        return;
     11}
     12/*}}}*/
     13void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     14        //      do nothing for now
     15        return;
     16}/*}}}*/
     17void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     18        int finiteelement=P1Enum;
     19        if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
     20        ::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
     21        iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
     22}
     23/*}}}*/
     24int  ExtrapolationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    925        return 1;
    10 }
    11 /*}}}*/
    12 void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    13         //do nothing for now
    14         return;
    1526}
    1627/*}}}*/
     
    3647}
    3748/*}}}*/
    38 void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    39         int finiteelement=P1Enum;
    40         if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
    41         ::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement);
    42         iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
    43 }
    44 /*}}}*/
    45 void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    46         // do nothing for now
     49void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
     50        //do nothing for now
    4751        return;
    4852}
    4953/*}}}*/
    50 void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
    51         //      do nothing for now
    52         return;
    53 }/*}}}*/
    5454
    5555/*Finite element Analysis*/
    56 void ExtrapolationAnalysis::Core(FemModel* femmodel){/*{{{*/
     56void           ExtrapolationAnalysis::Core(FemModel* femmodel){/*{{{*/
    5757
    5858        /* Intermediaries */
     
    237237        return pe;
    238238}/*}}}*/
    239 void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     239void           ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     240        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
     241         * For node i, Bi can be expressed in the actual coordinate system
     242         * by:
     243         *       Bi=[ N ]
     244         *          [ N ]
     245         * where N is the finiteelement function for node i.
     246         *
     247         * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
     248         */
     249
     250        /*Fetch number of nodes for this finite element*/
     251        int numnodes = element->GetNumberOfNodes();
     252
     253        /*Get nodal functions*/
     254        IssmDouble* basis=xNew<IssmDouble>(numnodes);
     255        element->NodalFunctions(basis,gauss);
     256
     257        /*Build B: */
     258        for(int i=0;i<numnodes;i++){
     259                B[numnodes*0+i] = basis[i];
     260                B[numnodes*1+i] = basis[i];
     261        }
     262
     263        /*Clean-up*/
     264        xDelete<IssmDouble>(basis);
     265}/*}}}*/
     266void           ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     267        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
     268         * For node i, Bi' can be expressed in the actual coordinate system
     269         * by:
     270         *       Bi_prime=[ dN/dx ]
     271         *                [ dN/dy ]
     272         * where N is the finiteelement function for node i.
     273         *
     274         * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
     275         */
     276
     277        /*Fetch number of nodes for this finite element*/
     278        int numnodes = element->GetNumberOfNodes();
     279
     280        /*Get nodal functions derivatives*/
     281        IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
     282        element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
     283
     284        /*Build B': */
     285        for(int i=0;i<numnodes;i++){
     286                Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
     287                Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
     288        }
     289
     290        /*Clean-up*/
     291        xDelete<IssmDouble>(dbasis);
     292
     293}/*}}}*/
     294void           ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    240295        _error_("not implemented yet");
    241296}/*}}}*/
    242 void ExtrapolationAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     297void           ExtrapolationAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    243298        _error_("Not implemented yet");
    244299}/*}}}*/
    245 void ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     300void           ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    246301
    247302        int domaintype, extrapolationvariable;
     
    258313        }
    259314}/*}}}*/
    260 void ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    261         /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    262          * For node i, Bi can be expressed in the actual coordinate system
    263          * by:
    264          *       Bi=[ N ]
    265          *          [ N ]
    266          * where N is the finiteelement function for node i.
    267          *
    268          * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes)
    269          */
    270 
    271         /*Fetch number of nodes for this finite element*/
    272         int numnodes = element->GetNumberOfNodes();
    273 
    274         /*Get nodal functions*/
    275         IssmDouble* basis=xNew<IssmDouble>(numnodes);
    276         element->NodalFunctions(basis,gauss);
    277 
    278         /*Build B: */
    279         for(int i=0;i<numnodes;i++){
    280                 B[numnodes*0+i] = basis[i];
    281                 B[numnodes*1+i] = basis[i];
    282         }
    283 
    284         /*Clean-up*/
    285         xDelete<IssmDouble>(basis);
    286 }/*}}}*/
    287 void ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    288         /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    289          * For node i, Bi' can be expressed in the actual coordinate system
    290          * by:
    291          *       Bi_prime=[ dN/dx ]
    292          *                [ dN/dy ]
    293          * where N is the finiteelement function for node i.
    294          *
    295          * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
    296          */
    297 
    298         /*Fetch number of nodes for this finite element*/
    299         int numnodes = element->GetNumberOfNodes();
    300 
    301         /*Get nodal functions derivatives*/
    302         IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
    303         element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
    304 
    305         /*Build B': */
    306         for(int i=0;i<numnodes;i++){
    307                 Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
    308                 Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
    309         }
    310 
    311         /*Clean-up*/
    312         xDelete<IssmDouble>(dbasis);
    313 
    314 }/*}}}*/
    315 void ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/
     315void           ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/
    316316
    317317        int numnodes=element->GetNumberOfNodes();       
     
    347347        delete gauss;
    348348}/*}}}*/
    349 void ExtrapolationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     349void           ExtrapolationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    350350
    351351        for(int i=0;i<femmodel->elements->Size();i++){
  • issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h

    r18057 r18929  
    1313 public:
    1414        /*Model processing*/
    15         int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16         void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17         void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18         void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915        void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016        void CreateLoads(Loads* loads, IoModel* iomodel);
     17        void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18        int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19        void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20        void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222        /*Finite element Analysis*/
     
    2626        ElementMatrix* CreateKMatrix(Element* element);
    2727        ElementVector* CreatePVector(Element* element);
    28                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    29                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    30         void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    31         void UpdateConstraints(FemModel* femmodel);
    32         void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
    33         void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
    34         void SetConstraintsOnIce(Element* element);
     28        void           GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
     29        void           GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
     30        void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     31        void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     32        void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     33        void           SetConstraintsOnIce(Element* element);
     34        void           UpdateConstraints(FemModel* femmodel);
    3535};
    3636#endif
  • issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp

    r18057 r18929  
    66
    77/*Model processing*/
     8void ExtrudeFromBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9}/*}}}*/
     10void ExtrudeFromBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     11}/*}}}*/
     12void ExtrudeFromBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     13
     14        ::CreateNodes(nodes,iomodel,ExtrudeFromBaseAnalysisEnum,P1Enum);
     15
     16}/*}}}*/
    817int  ExtrudeFromBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    918        return 1;
    10 }/*}}}*/
    11 void ExtrudeFromBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    1219}/*}}}*/
    1320void ExtrudeFromBaseAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     
    2633        }
    2734}/*}}}*/
    28 void ExtrudeFromBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    29 
    30         ::CreateNodes(nodes,iomodel,ExtrudeFromBaseAnalysisEnum,P1Enum);
    31 
    32 }/*}}}*/
    33 void ExtrudeFromBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    34 }/*}}}*/
    35 void ExtrudeFromBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     35void ExtrudeFromBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    3636}/*}}}*/
    3737
     
    6161        return Ke;
    6262}/*}}}*/
     63ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixBed(Element* element){/*{{{*/
     64
     65        if(!element->IsOnBase()) return NULL;
     66
     67        /*Intermediaries */
     68        int         dim;
     69        IssmDouble  Jdet,D,normal[3];
     70        IssmDouble *xyz_list_base = NULL;
     71
     72        /*Get dimension*/
     73        element->FindParam(&dim,DomainDimensionEnum);
     74
     75        /*Fetch number of nodes and dof for this finite element*/
     76        int numnodes = element->GetNumberOfNodes();
     77
     78        /*Initialize Element vector and other vectors*/
     79        ElementMatrix* Ke    = element->NewElementMatrix();
     80        IssmDouble*    basis = xNew<IssmDouble>(numnodes);
     81
     82        /*Retrieve all inputs and parameters*/
     83        element->GetVerticesCoordinatesBase(&xyz_list_base);
     84        element->NormalBase(&normal[0],xyz_list_base);
     85
     86        /* Start  looping on the number of gaussian points: */
     87        Gauss* gauss=element->NewGaussBase(2);
     88        for(int ig=gauss->begin();ig<gauss->end();ig++){
     89                gauss->GaussPoint(ig);
     90
     91                element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
     92                element->NodalFunctions(basis,gauss);
     93                D = - gauss->weight*Jdet*normal[dim-1];
     94
     95                TripleMultiply(basis,1,numnodes,1,
     96                                        &D,1,1,0,
     97                                        basis,1,numnodes,0,
     98                                        &Ke->values[0],1);
     99        }
     100
     101        /*Clean up and return*/
     102        xDelete<IssmDouble>(xyz_list_base);
     103        xDelete<IssmDouble>(basis);
     104        delete gauss;
     105        return Ke;
     106}
     107/*}}}*/
     108ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/
     109
     110        if(!element->IsOnSurface()) return NULL;
     111
     112        /*Intermediaries */
     113        int         dim;
     114        IssmDouble  Jdet,D,normal[3];
     115        IssmDouble *xyz_list_top = NULL;
     116
     117        /*Get dimension*/
     118        element->FindParam(&dim,DomainDimensionEnum);
     119
     120        /*Fetch number of nodes and dof for this finite element*/
     121        int numnodes = element->GetNumberOfNodes();
     122
     123        /*Initialize Element vector and other vectors*/
     124        ElementMatrix* Ke    = element->NewElementMatrix();
     125        IssmDouble*    basis = xNew<IssmDouble>(numnodes);
     126
     127        /*Retrieve all inputs and parameters*/
     128        element->GetVerticesCoordinatesTop(&xyz_list_top);
     129        element->NormalTop(&normal[0],xyz_list_top);
     130
     131        /* Start  looping on the number of gaussian points: */
     132        Gauss* gauss=element->NewGaussTop(2);
     133        for(int ig=gauss->begin();ig<gauss->end();ig++){
     134                gauss->GaussPoint(ig);
     135
     136                element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
     137                element->NodalFunctions(basis,gauss);
     138                D = - gauss->weight*Jdet*normal[dim-1];
     139
     140                TripleMultiply(basis,1,numnodes,1,
     141                                        &D,1,1,0,
     142                                        basis,1,numnodes,0,
     143                                        &Ke->values[0],1);
     144        }
     145
     146        /*Clean up and return*/
     147        xDelete<IssmDouble>(xyz_list_top);
     148        xDelete<IssmDouble>(basis);
     149        delete gauss;
     150        return Ke;
     151}
     152/*}}}*/
    63153ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/
    64154
     
    106196}
    107197/*}}}*/
    108 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/
    109 
    110         if(!element->IsOnSurface()) return NULL;
    111 
    112         /*Intermediaries */
    113         int         dim;
    114         IssmDouble  Jdet,D,normal[3];
    115         IssmDouble *xyz_list_top = NULL;
    116 
    117         /*Get dimension*/
    118         element->FindParam(&dim,DomainDimensionEnum);
    119 
    120         /*Fetch number of nodes and dof for this finite element*/
    121         int numnodes = element->GetNumberOfNodes();
    122 
    123         /*Initialize Element vector and other vectors*/
    124         ElementMatrix* Ke    = element->NewElementMatrix();
    125         IssmDouble*    basis = xNew<IssmDouble>(numnodes);
    126 
    127         /*Retrieve all inputs and parameters*/
    128         element->GetVerticesCoordinatesTop(&xyz_list_top);
    129         element->NormalTop(&normal[0],xyz_list_top);
    130 
    131         /* Start  looping on the number of gaussian points: */
    132         Gauss* gauss=element->NewGaussTop(2);
    133         for(int ig=gauss->begin();ig<gauss->end();ig++){
    134                 gauss->GaussPoint(ig);
    135 
    136                 element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
    137                 element->NodalFunctions(basis,gauss);
    138                 D = - gauss->weight*Jdet*normal[dim-1];
    139 
    140                 TripleMultiply(basis,1,numnodes,1,
    141                                         &D,1,1,0,
    142                                         basis,1,numnodes,0,
    143                                         &Ke->values[0],1);
    144         }
    145 
    146         /*Clean up and return*/
    147         xDelete<IssmDouble>(xyz_list_top);
    148         xDelete<IssmDouble>(basis);
    149         delete gauss;
    150         return Ke;
    151 }
    152 /*}}}*/
    153 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixBed(Element* element){/*{{{*/
    154 
    155         if(!element->IsOnBase()) return NULL;
    156 
    157         /*Intermediaries */
    158         int         dim;
    159         IssmDouble  Jdet,D,normal[3];
    160         IssmDouble *xyz_list_base = NULL;
    161 
    162         /*Get dimension*/
    163         element->FindParam(&dim,DomainDimensionEnum);
    164 
    165         /*Fetch number of nodes and dof for this finite element*/
    166         int numnodes = element->GetNumberOfNodes();
    167 
    168         /*Initialize Element vector and other vectors*/
    169         ElementMatrix* Ke    = element->NewElementMatrix();
    170         IssmDouble*    basis = xNew<IssmDouble>(numnodes);
    171 
    172         /*Retrieve all inputs and parameters*/
    173         element->GetVerticesCoordinatesBase(&xyz_list_base);
    174         element->NormalBase(&normal[0],xyz_list_base);
    175 
    176         /* Start  looping on the number of gaussian points: */
    177         Gauss* gauss=element->NewGaussBase(2);
    178         for(int ig=gauss->begin();ig<gauss->end();ig++){
    179                 gauss->GaussPoint(ig);
    180 
    181                 element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
    182                 element->NodalFunctions(basis,gauss);
    183                 D = - gauss->weight*Jdet*normal[dim-1];
    184 
    185                 TripleMultiply(basis,1,numnodes,1,
    186                                         &D,1,1,0,
    187                                         basis,1,numnodes,0,
    188                                         &Ke->values[0],1);
    189         }
    190 
    191         /*Clean up and return*/
    192         xDelete<IssmDouble>(xyz_list_base);
    193         xDelete<IssmDouble>(basis);
    194         delete gauss;
    195         return Ke;
    196 }
    197 /*}}}*/
    198198ElementVector* ExtrudeFromBaseAnalysis::CreatePVector(Element* element){/*{{{*/
    199199        return NULL;
    200200}/*}}}*/
    201 void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     201void           ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    202202        /*      Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
    203203                where hi is the interpolation function for node i.*/
     
    219219}
    220220/*}}}*/
    221 void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     221void           ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    222222           _error_("not implemented yet");
    223223}/*}}}*/
    224 void ExtrudeFromBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     224void           ExtrudeFromBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    225225        _error_("Not implemented yet");
    226226}/*}}}*/
    227 void ExtrudeFromBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     227void           ExtrudeFromBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    228228
    229229        int inputenum;
     
    231231        element->InputUpdateFromSolutionOneDof(solution,inputenum);
    232232}/*}}}*/
    233 void ExtrudeFromBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     233void           ExtrudeFromBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    234234        /*Default, do nothing*/
    235235        return;
  • issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h

    r18057 r18929  
    1313        public:
    1414                /*Model processing*/
    15                 int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16                 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17                 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18                 void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915                void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016                void CreateLoads(Loads* loads, IoModel* iomodel);
     17                void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18                int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19                void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20                void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222                /*Finite element Analysis*/
     
    2525                ElementMatrix* CreateJacobianMatrix(Element* element);
    2626                ElementMatrix* CreateKMatrix(Element* element);
     27                ElementMatrix* CreateKMatrixBed(Element* element);
     28                ElementMatrix* CreateKMatrixSurface(Element* element);
    2729                ElementMatrix* CreateKMatrixVolume(Element* element);
    28                 ElementMatrix* CreateKMatrixSurface(Element* element);
    29                 ElementMatrix* CreateKMatrixBed(Element* element);
    3030                ElementVector* CreatePVector(Element* element);
    31                 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    32                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    33                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    34                 void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    35                 void UpdateConstraints(FemModel* femmodel);
     31                void           GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     32                void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     33                void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     34                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     35                void           UpdateConstraints(FemModel* femmodel);
    3636};
    3737#endif
  • issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp

    r18057 r18929  
    66
    77/*Model processing*/
     8void ExtrudeFromTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9}/*}}}*/
     10void ExtrudeFromTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     11}/*}}}*/
     12void ExtrudeFromTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     13
     14        ::CreateNodes(nodes,iomodel,ExtrudeFromTopAnalysisEnum,P1Enum);
     15
     16}/*}}}*/
    817int  ExtrudeFromTopAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    918        return 1;
    10 }/*}}}*/
    11 void ExtrudeFromTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    1219}/*}}}*/
    1320void ExtrudeFromTopAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     
    2633        }
    2734}/*}}}*/
    28 void ExtrudeFromTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    29 
    30         ::CreateNodes(nodes,iomodel,ExtrudeFromTopAnalysisEnum,P1Enum);
    31 
    32 }/*}}}*/
    33 void ExtrudeFromTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    34 }/*}}}*/
    35 void ExtrudeFromTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     35void ExtrudeFromTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    3636}/*}}}*/
    3737
     
    199199        return NULL;
    200200}/*}}}*/
    201 void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     201void           ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    202202        /*      Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
    203203                where hi is the interpolation function for node i.*/
     
    219219}
    220220/*}}}*/
    221 void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     221void           ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    222222           _error_("not implemented yet");
    223223}/*}}}*/
    224 void ExtrudeFromTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     224void           ExtrudeFromTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    225225        _error_("Not implemented yet");
    226226}/*}}}*/
    227 void ExtrudeFromTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     227void           ExtrudeFromTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    228228
    229229        int inputenum;
     
    231231        element->InputUpdateFromSolutionOneDof(solution,inputenum);
    232232}/*}}}*/
    233 void ExtrudeFromTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     233void           ExtrudeFromTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    234234        /*Default, do nothing*/
    235235        return;
  • issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h

    r18057 r18929  
    1313        public:
    1414                /*Model processing*/
    15                 int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16                 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17                 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18                 void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915                void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016                void CreateLoads(Loads* loads, IoModel* iomodel);
     17                void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18                int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19                void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20                void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222                /*Finite element Analysis*/
     
    2525                ElementMatrix* CreateJacobianMatrix(Element* element);
    2626                ElementMatrix* CreateKMatrix(Element* element);
     27                ElementMatrix* CreateKMatrixBed(Element* element);
     28                ElementMatrix* CreateKMatrixSurface(Element* element);
    2729                ElementMatrix* CreateKMatrixVolume(Element* element);
    28                 ElementMatrix* CreateKMatrixSurface(Element* element);
    29                 ElementMatrix* CreateKMatrixBed(Element* element);
    3030                ElementVector* CreatePVector(Element* element);
    31                 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    32                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    33                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    34                 void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    35                 void UpdateConstraints(FemModel* femmodel);
     31                void           GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     32                void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     33                void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     34                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     35                void           UpdateConstraints(FemModel* femmodel);
    3636};
    3737#endif
  • issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp

    r18521 r18929  
    66
    77/*Model processing*/
     8void FreeSurfaceBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9}/*}}}*/
     10void FreeSurfaceBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     11
     12        /*Intermediaries*/
     13        int penpair_ids[2];
     14        int count=0;
     15        int numvertex_pairing;
     16
     17        /*Create Penpair for vertex_pairing: */
     18        IssmDouble *vertex_pairing=NULL;
     19        IssmDouble *nodeonbase=NULL;
     20        iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
     21        if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
     22        for(int i=0;i<numvertex_pairing;i++){
     23
     24                if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
     25
     26                        /*In debugging mode, check that the second node is in the same cpu*/
     27                        _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
     28
     29                        /*Skip if one of the two is not on the bed*/
     30                        if(iomodel->domaintype!=Domain2DhorizontalEnum){
     31                                if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
     32                        }
     33
     34                        /*Get node ids*/
     35                        penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
     36                        penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]);
     37
     38                        /*Create Load*/
     39                        loads->AddObject(new Penpair(
     40                                                        iomodel->loadcounter+count+1,
     41                                                        &penpair_ids[0],
     42                                                        FreeSurfaceBaseAnalysisEnum));
     43                        count++;
     44                }
     45        }
     46
     47        /*free ressources: */
     48        iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
     49        iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
     50}/*}}}*/
     51void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     52
     53        if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
     54        ::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum);
     55        iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
     56}/*}}}*/
    857int  FreeSurfaceBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    958        return 1;
    10 }/*}}}*/
    11 void FreeSurfaceBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    1259}/*}}}*/
    1360void FreeSurfaceBaseAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     
    4390        }
    4491}/*}}}*/
    45 void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    46 
    47         if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
    48         ::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum);
    49         iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
    50 }/*}}}*/
    51 void FreeSurfaceBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    52 }/*}}}*/
    53 void FreeSurfaceBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
    54 
    55         /*Intermediaries*/
    56         int penpair_ids[2];
    57         int count=0;
    58         int numvertex_pairing;
    59 
    60         /*Create Penpair for vertex_pairing: */
    61         IssmDouble *vertex_pairing=NULL;
    62         IssmDouble *nodeonbase=NULL;
    63         iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
    64         if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum);
    65         for(int i=0;i<numvertex_pairing;i++){
    66 
    67                 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
    68 
    69                         /*In debugging mode, check that the second node is in the same cpu*/
    70                         _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
    71 
    72                         /*Skip if one of the two is not on the bed*/
    73                         if(iomodel->domaintype!=Domain2DhorizontalEnum){
    74                                 if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
    75                         }
    76 
    77                         /*Get node ids*/
    78                         penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
    79                         penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]);
    80 
    81                         /*Create Load*/
    82                         loads->AddObject(new Penpair(
    83                                                         iomodel->loadcounter+count+1,
    84                                                         &penpair_ids[0],
    85                                                         FreeSurfaceBaseAnalysisEnum));
    86                         count++;
    87                 }
    88         }
    89 
    90         /*free ressources: */
    91         iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
    92         iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum);
     92void FreeSurfaceBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    9393}/*}}}*/
    9494
     
    304304
    305305}/*}}}*/
    306 void FreeSurfaceBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     306void           FreeSurfaceBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    307307        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    308308         * For node i, Bi can be expressed in the actual coordinate system
     
    332332        xDelete<IssmDouble>(basis);
    333333}/*}}}*/
    334 void FreeSurfaceBaseAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     334void           FreeSurfaceBaseAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    335335        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    336336         * For node i, Bi' can be expressed in the actual coordinate system
     
    361361
    362362}/*}}}*/
    363 void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     363void           FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    364364           _error_("not implemented yet");
    365365}/*}}}*/
    366 void FreeSurfaceBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     366void           FreeSurfaceBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    367367        _error_("Not implemented yet");
    368368}/*}}}*/
    369 void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     369void           FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    370370        element->InputUpdateFromSolutionOneDof(solution,BaseEnum);
    371371}/*}}}*/
    372 void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     372void           FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    373373
    374374        /*Intermediary*/
  • issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h

    r18057 r18929  
    1313        public:
    1414                /*Model processing*/
    15                 int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16                 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17                 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18                 void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915                void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016                void CreateLoads(Loads* loads, IoModel* iomodel);
     17                void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18                int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19                void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20                void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222                /*Finite element Analysis*/
     
    2626                ElementMatrix* CreateKMatrix(Element* element);
    2727                ElementVector* CreatePVector(Element* element);
    28                 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    29                 void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    30                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    31                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    32                 void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    33                 void UpdateConstraints(FemModel* femmodel);
     28                void           GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     29                void           GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     30                void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     31                void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     32                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     33                void           UpdateConstraints(FemModel* femmodel);
    3434};
    3535#endif
  • issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp

    r18057 r18929  
    66
    77/*Model processing*/
     8void FreeSurfaceTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9}/*}}}*/
     10void FreeSurfaceTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     11
     12        /*Intermediaries*/
     13        int penpair_ids[2];
     14        int count=0;
     15        int numvertex_pairing;
     16
     17        /*Create Penpair for vertex_pairing: */
     18        IssmDouble *vertex_pairing=NULL;
     19        IssmDouble *nodeonsurface=NULL;
     20        iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
     21        if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
     22        for(int i=0;i<numvertex_pairing;i++){
     23
     24                if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
     25
     26                        /*In debugging mode, check that the second node is in the same cpu*/
     27                        _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
     28
     29                        /*Skip if one of the two is not on the bed*/
     30                        if(iomodel->domaintype!=Domain2DhorizontalEnum){
     31                                if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
     32                        }
     33
     34                        /*Get node ids*/
     35                        penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
     36                        penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]);
     37
     38                        /*Create Load*/
     39                        loads->AddObject(new Penpair(
     40                                                        iomodel->loadcounter+count+1,
     41                                                        &penpair_ids[0],
     42                                                        FreeSurfaceTopAnalysisEnum));
     43                        count++;
     44                }
     45        }
     46
     47        /*free ressources: */
     48        iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
     49        iomodel->DeleteData(nodeonsurface,MeshVertexonsurfaceEnum);
     50}/*}}}*/
     51void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     52
     53        if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
     54        ::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum);
     55        iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
     56}/*}}}*/
    857int  FreeSurfaceTopAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    958        return 1;
    10 }/*}}}*/
    11 void FreeSurfaceTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    1259}/*}}}*/
    1360void FreeSurfaceTopAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     
    5198        }
    5299}/*}}}*/
    53 void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    54 
    55         if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
    56         ::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum);
    57         iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
    58 }/*}}}*/
    59 void FreeSurfaceTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    60 }/*}}}*/
    61 void FreeSurfaceTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
    62 
    63         /*Intermediaries*/
    64         int penpair_ids[2];
    65         int count=0;
    66         int numvertex_pairing;
    67 
    68         /*Create Penpair for vertex_pairing: */
    69         IssmDouble *vertex_pairing=NULL;
    70         IssmDouble *nodeonsurface=NULL;
    71         iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum);
    72         if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum);
    73         for(int i=0;i<numvertex_pairing;i++){
    74 
    75                 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
    76 
    77                         /*In debugging mode, check that the second node is in the same cpu*/
    78                         _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
    79 
    80                         /*Skip if one of the two is not on the bed*/
    81                         if(iomodel->domaintype!=Domain2DhorizontalEnum){
    82                                 if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
    83                         }
    84 
    85                         /*Get node ids*/
    86                         penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
    87                         penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]);
    88 
    89                         /*Create Load*/
    90                         loads->AddObject(new Penpair(
    91                                                         iomodel->loadcounter+count+1,
    92                                                         &penpair_ids[0],
    93                                                         FreeSurfaceTopAnalysisEnum));
    94                         count++;
    95                 }
    96         }
    97 
    98         /*free ressources: */
    99         iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum);
    100         iomodel->DeleteData(nodeonsurface,MeshVertexonsurfaceEnum);
     100void FreeSurfaceTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    101101}/*}}}*/
    102102
     
    307307
    308308}/*}}}*/
    309 void FreeSurfaceTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     309void           FreeSurfaceTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    310310        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    311311         * For node i, Bi can be expressed in the actual coordinate system
     
    335335        xDelete<IssmDouble>(basis);
    336336}/*}}}*/
    337 void FreeSurfaceTopAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     337void           FreeSurfaceTopAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    338338        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    339339         * For node i, Bi' can be expressed in the actual coordinate system
     
    364364
    365365}/*}}}*/
    366 void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     366void           FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    367367           _error_("not implemented yet");
    368368}/*}}}*/
    369 void FreeSurfaceTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     369void           FreeSurfaceTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    370370        _error_("Not implemented yet");
    371371}/*}}}*/
    372 void FreeSurfaceTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     372void           FreeSurfaceTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    373373
    374374        element->InputUpdateFromSolutionOneDof(solution,SurfaceEnum);
    375375}/*}}}*/
    376 void FreeSurfaceTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     376void           FreeSurfaceTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    377377        /*Default, do nothing*/
    378378        return;
  • issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h

    r18057 r18929  
    1313        public:
    1414                /*Model processing*/
    15                 int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16                 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17                 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18                 void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915                void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016                void CreateLoads(Loads* loads, IoModel* iomodel);
     17                void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18                int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19                void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20                void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222                /*Finite element Analysis*/
     
    2626                ElementMatrix* CreateKMatrix(Element* element);
    2727                ElementVector* CreatePVector(Element* element);
    28                 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    29                 void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
    30                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    31                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    32                 void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    33                 void UpdateConstraints(FemModel* femmodel);
     28                void           GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     29                void           GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
     30                void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     31                void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     32                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     33                void           UpdateConstraints(FemModel* femmodel);
    3434};
    3535#endif
  • issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp

    r18057 r18929  
    66
    77/*Model processing*/
     8void GiaAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9        /*No constraints*/
     10}/*}}}*/
     11void GiaAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     12        /*No loads*/
     13}/*}}}*/
     14void GiaAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
     15        ::CreateNodes(nodes,iomodel,GiaAnalysisEnum,P1Enum);
     16}/*}}}*/
    817int  GiaAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    918        return 1;
    10 }/*}}}*/
    11 void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    1219}/*}}}*/
    1320void GiaAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     
    2734        iomodel->FetchDataToInput(elements,GiaLithosphereThicknessEnum);
    2835}/*}}}*/
    29 void GiaAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
    30         ::CreateNodes(nodes,iomodel,GiaAnalysisEnum,P1Enum);
    31 }/*}}}*/
    32 void GiaAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    33         /*No constraints*/
    34 }/*}}}*/
    35 void GiaAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
    36         /*No loads*/
     36void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    3737}/*}}}*/
    3838
     
    5454_error_("not implemented yet");
    5555}/*}}}*/
    56 void GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     56void           GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    5757           _error_("not implemented yet");
    5858}/*}}}*/
    59 void GiaAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     59void           GiaAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
    6060        _error_("Not implemented yet");
    6161}/*}}}*/
    62 void GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     62void           GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    6363        _error_("not implemented yet");
    6464}/*}}}*/
    65 void GiaAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     65void           GiaAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    6666        /*Default, do nothing*/
    6767        return;
  • issm/trunk-jpl/src/c/analyses/GiaAnalysis.h

    r18057 r18929  
    1313        public:
    1414                /*Model processing*/
    15                 int  DofsPerNode(int** doflist,int domaintype,int approximation);
    16                 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    17                 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
    18                 void CreateNodes(Nodes* nodes,IoModel* iomodel);
    1915                void CreateConstraints(Constraints* constraints,IoModel* iomodel);
    2016                void CreateLoads(Loads* loads, IoModel* iomodel);
     17                void CreateNodes(Nodes* nodes,IoModel* iomodel);
     18                int  DofsPerNode(int** doflist,int domaintype,int approximation);
     19                void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
     20                void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
    2121
    2222                /*Finite element Analysis*/
     
    2626                ElementMatrix* CreateKMatrix(Element* element);
    2727                ElementVector* CreatePVector(Element* element);
    28                 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
    29                 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
    30                 void InputUpdateFromSolution(IssmDouble* solution,Element* element);
    31                 void UpdateConstraints(FemModel* femmodel);
     28                void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
     29                void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
     30                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
     31                void           UpdateConstraints(FemModel* femmodel);
    3232};
    3333#endif
Note: See TracChangeset for help on using the changeset viewer.