source: issm/oecreview/Archive/22819-23185/ISSM-23172-23173.diff

Last change on this file was 23186, checked in by Mathieu Morlighem, 7 years ago

CHG: added Archive/22819-23185

File size: 5.5 KB
  • ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp

     
    5555                xDelete<IssmDouble>(mask);
    5656        }
    5757}/*}}}*/
    58 void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
    5958
     59void GetMaskOfIceVerticesLSMx0(FemModel* femmodel){/*{{{*/
     60
    6061        /*Initialize vector with number of vertices*/
    6162        int numvertices=femmodel->vertices->NumberOfVertices();
    6263        if(numvertices==0)  return;
     
    8283        delete vec_mask_ice;
    8384        xDelete<IssmDouble>(mask_ice);
    8485}/*}}}*/
     86void GetMaskOfIceVerticesLSMx(FemModel* femmodel){/*{{{*/
     87
     88        femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum);
     89
     90        /*Create vector on gset*/
     91        int configuration_type;
     92        femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
     93        int gsize=femmodel->nodes->NumberOfDofs(configuration_type,GsetEnum);
     94        if(gsize==0)  return;
     95        Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(gsize);
     96
     97        /*Fill vector with values: */
     98        for(int i=0;i<femmodel->elements->Size();i++){
     99                Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
     100
     101                if(element->IsIceInElement()){
     102                        int numnodes = element->GetNumberOfNodes();
     103                        int  gsize_local=GetNumberOfDofs(element->nodes,numnodes,GsetEnum,NoneEnum);
     104                        int* glist_local=GetGlobalDofList(element->nodes,numnodes,GsetEnum,NoneEnum);
     105                        IssmDouble* ones = xNew<IssmDouble>(gsize_local);
     106                        for(int n=0;n<gsize_local;n++) ones[n] = 1.;
     107                        vec_mask_ice->SetValues(gsize_local,glist_local,ones,INS_VAL);
     108                        xDelete<IssmDouble>(ones);
     109                        xDelete<int>(glist_local);
     110                }
     111        }
     112
     113        /*Assemble vector and serialize */
     114        vec_mask_ice->Assemble();
     115        IssmDouble* mask_ice=vec_mask_ice->ToMPISerial();
     116        delete vec_mask_ice;
     117        for(int i=0;i<femmodel->elements->Size();i++){
     118                Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
     119                element->InputUpdateFromSolutionOneDof(mask_ice,IceMaskNodeActivationEnum);
     120        }
     121
     122        /*Clean up and return*/
     123        xDelete<IssmDouble>(mask_ice);
     124}/*}}}*/
  • ../trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.h

     
    88#include "../../classes/classes.h"
    99
    1010void SetActiveNodesLSMx(FemModel* femmodel);
     11void GetMaskOfIceVerticesLSMx0(FemModel* femmodel);
    1112void GetMaskOfIceVerticesLSMx(FemModel* femmodel);
    12 #endif  /* _UPDATESPCSX_H */
     13#endif  /* _SETACTIVENODESLSMX_H*/
  • ../trunk-jpl/src/c/classes/FemModel.cpp

     
    404404                        VerticesDofx(vertices,parameters);
    405405
    406406                        if(VerboseMProcessor()) _printf0_("      detecting active vertices\n");
    407                         GetMaskOfIceVerticesLSMx(this);
     407                        GetMaskOfIceVerticesLSMx0(this);
    408408                }
    409409
    410410                if(VerboseMProcessor()) _printf0_("      resolving node constraints\n");
     
    26322632        delete this->constraints;       this->constraints       = new_constraints;
    26332633        delete this->materials;         this->materials = new_materials;
    26342634
    2635         GetMaskOfIceVerticesLSMx(this);
     2635        GetMaskOfIceVerticesLSMx0(this);
    26362636
    26372637        /*Insert MISMIP+ bed topography FIXME it could be stay in another place*/
    26382638        this->parameters->FindParam(&basalforcing_model,BasalforcingsEnum);
  • ../trunk-jpl/src/c/classes/Elements/Tria.cpp

     
    39583958
    39593959        _assert_(fieldvalue==0.); //field value != 0 not implemented yet
    39603960
     3961        /*Get field on vertices (we do not allow for higher order elements!!)*/
     3962        IssmDouble lsf[NUMVERTICES];
     3963        this->GetInputListOnVertices(&lsf[0],fieldenum);
     3964
    39613965        /*1. check that we do cross fieldvalue in this element*/
    3962         Input* input = inputs->GetInput(fieldenum);
    3963         if(!input) _error_("Cannot calculate distance to "<<EnumToStringx(fieldenum)<<", input not found");
    3964         IssmDouble minvalue = input->Min();
     3966        IssmDouble minvalue = lsf[0];
     3967        IssmDouble maxvalue = lsf[0];
     3968        for(int i=1;i<NUMVERTICES;i++){
     3969                if(lsf[i]>maxvalue) maxvalue = lsf[i];
     3970                if(lsf[i]<minvalue) minvalue = lsf[i];
     3971        }
    39653972        if(minvalue>fieldvalue) return;
    3966         IssmDouble maxvalue = input->Max();
    39673973        if(maxvalue<fieldvalue) return;
    39683974
    39693975        /*2. Find coordinates of where levelset crosses 0*/
     
    39873993                }
    39883994        }
    39893995        else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge
    3990                 IssmDouble lsf[NUMVERTICES];
    3991                 this->GetInputListOnVertices(&lsf[0],fieldenum);
     3996
    39923997                for(int i=0;i<NUMVERTICES;i++){
    39933998                        if(lsf[indices[i]]==0.){
    39943999                                x[counter]=xyz_list[indices[i]][0];
  • ../trunk-jpl/src/c/classes/Nodes.cpp

     
    348348        /*Grab max of all cpus: */
    349349        ISSM_MPI_Allreduce((void*)&flag,(void*)&allflag,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
    350350
    351         if(allflag){
    352                 return true;
    353         }
    354         else{
    355                 return false;
    356         }
     351        if(allflag) return true;
     352        else        return false;
    357353}
    358354/*}}}*/
Note: See TracBrowser for help on using the repository browser.