Ignore:
Timestamp:
02/06/15 16:44:07 (10 years ago)
Author:
bdef
Message:

CHG: Adding node capbility for inputupdatefromvector and changes in the zigzag counter in epl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Element.cpp ΒΆ

    r19019 r19094  
    862862}
    863863/*}}}*/
    864 void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){/*{{{*/
     864/* void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){/\*{{{*\/ */
     865
     866/*      /\*Fetch number vertices for this element and allocate arrays*\/ */
     867/*      int numvertices = this->GetNumberOfVertices(); */
     868/*      int*        vertexpidlist = xNew<int>(numvertices); */
     869/*      IssmDouble* values        = xNew<IssmDouble>(numvertices); */
     870
     871/*      /\*Fill in values*\/ */
     872/*      this->GetVertexPidList(vertexpidlist); */
     873/*      this->GetInputListOnVertices(values,input_enum); */
     874/*      vector->SetValues(numvertices,vertexpidlist,values,INS_VAL); */
     875
     876/*      /\*Clean up*\/ */
     877/*      xDelete<int>(vertexpidlist); */
     878/*      xDelete<IssmDouble>(values); */
     879
     880/* } */
     881/* /\*}}}*\/ */
     882void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum,int type){/*{{{*/
    865883
    866884        /*Fetch number vertices for this element and allocate arrays*/
    867         int numvertices = this->GetNumberOfVertices();
    868         int*        vertexpidlist = xNew<int>(numvertices);
    869         IssmDouble* values        = xNew<IssmDouble>(numvertices);
    870 
    871         /*Fill in values*/
    872         this->GetVertexPidList(vertexpidlist);
    873         this->GetInputListOnVertices(values,input_enum);
    874         vector->SetValues(numvertices,vertexpidlist,values,INS_VAL);
    875 
     885        int         numvertices = this->GetNumberOfVertices();
     886        int         numnodes    = this->GetNumberOfNodes();
     887        int*        doflist     = NULL;
     888        IssmDouble* values      = NULL;
     889
     890        switch(type){
     891        case VertexPIdEnum:
     892                doflist = xNew<int>(numvertices);
     893                values = xNew<IssmDouble>(numvertices);
     894                /*Fill in values*/
     895                this->GetVertexPidList(doflist);
     896                this->GetInputListOnVertices(values,input_enum);
     897                vector->SetValues(numvertices,doflist,values,INS_VAL);
     898                break;
     899        case VertexSIdEnum:
     900                doflist = xNew<int>(numvertices);
     901                values = xNew<IssmDouble>(numvertices);
     902                /*Fill in values*/
     903                this->GetVerticesSidList(doflist);
     904                this->GetInputListOnVertices(values,input_enum);
     905                vector->SetValues(numvertices,doflist,values,INS_VAL);
     906                break;
     907        case NodesEnum:
     908                doflist = xNew<int>(numnodes);
     909                values = xNew<IssmDouble>(numnodes);
     910                /*Fill in values*/
     911                this->GetInputListOnNodes(values,input_enum);
     912                this->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
     913                vector->SetValues(numnodes,doflist,values,INS_VAL);
     914                break;
     915        case NodeSIdEnum:
     916                doflist = xNew<int>(numnodes);
     917                values = xNew<IssmDouble>(numnodes);
     918                /*Fill in values*/
     919                this->GetNodesSidList(doflist);
     920                this->GetInputListOnNodes(values,input_enum);
     921                vector->SetValues(numnodes,doflist,values,INS_VAL);
     922                break;
     923        default:
     924                _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
     925        }
     926       
    876927        /*Clean up*/
    877         xDelete<int>(vertexpidlist);
     928        xDelete<int>(doflist);
    878929        xDelete<IssmDouble>(values);
    879930
Note: See TracChangeset for help on using the changeset viewer.