Changeset 24398


Ignore:
Timestamp:
11/25/19 16:16:43 (5 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added intinput as output, Partitioning as a possible requested_output and weights on ice free elements

Location:
issm/trunk-jpl/src/c
Files:
7 edited

Legend:

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

    r24387 r24398  
    32343234                case SurfaceCrevasseEnum: this->CalvingCrevasseDepth(); break;
    32353235                case SigmaVMEnum: this->CalvingRateVonmises(); break;
     3236                case PartitioningEnum: this->inputs2->SetInput(PartitioningEnum,this->lid,IssmComm::GetRank()); break;
    32363237        }
    32373238
     
    32533254                        *parray_size      = 1;
    32543255                        break;
     3256                case IntInput2Enum:
     3257                        *pinterpolation   = P0Enum;
     3258                        *pnodesperelement = 1;
     3259                        *parray_size      = 1;
     3260                        break;
    32553261                case ArrayInput2Enum:{
    32563262                        int M;
     
    33363342                        this->GetInput2Value(&bvalue,output_enum);
    33373343                        vector->SetValue(this->Sid(),reCast<IssmDouble>(bvalue),INS_VAL);
     3344                        break;
     3345                case IntInput2Enum:
     3346                        int ivalue;
     3347                        this->GetInput2Value(&ivalue,output_enum);
     3348                        vector->SetValue(this->Sid(),reCast<IssmDouble>(ivalue),INS_VAL);
    33383349                        break;
    33393350                default:
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r24396 r24398  
    6060        }
    6161
     62        /*Use ice levelset for weights*/
     63        int fordan = 0;
     64        int* weights = NULL;
     65        if(fordan){
     66                IssmDouble* icelevelset = NULL;
     67                iomodel->FetchData(&icelevelset,NULL,NULL,"md.mask.ice_levelset");
     68
     69                weights = xNew<int>(iomodel->numberofvertices);
     70                for(int i=0;i<iomodel->numberofvertices;i++){
     71                        if(icelevelset[i]>=0) weights[i] = 1;
     72                        if(icelevelset[i]<0)  weights[i] = 100;
     73                }
     74                xDelete<IssmDouble>(icelevelset);
     75        }
     76
    6277        /*Partition and free resouces*/
    63         MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,NULL,numlayers,elements_width,iomodel->meshelementtype,num_procs);
     78        MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,weights,numlayers,elements_width,iomodel->meshelementtype,num_procs);
    6479        xDelete<int>(elements2d);
    6580        xDelete<int>(npart);
     81        xDelete<int>(weights);
     82
     83        if(fordan){
     84                for(int i=0;i<IssmComm::GetSize();i++){
     85                        if(i==IssmComm::GetRank()){
     86                                int temp =0;
     87                                for(int j=0;j<iomodel->numberofelements;j++) if(epart[j]==i) temp++;
     88                                _printf_("Partition #"<<i<<" number of elements: "<<temp<<"\n");
     89                        }
     90                        ISSM_MPI_Barrier(IssmComm::GetComm());
     91                }
     92        }
    6693
    6794        /*Deal with rifts, they have to be included into one partition only, not several: */
  • issm/trunk-jpl/src/c/shared/Enum/Enum.vim

    r24335 r24398  
    633633syn keyword cConstant P0Enum
    634634syn keyword cConstant P1Enum
     635syn keyword cConstant PartitioningEnum
    635636syn keyword cConstant PressureEnum
    636637syn keyword cConstant RadarEnum
     
    13161317syn keyword cType AmrBamg
    13171318syn keyword cType ArrayInput2
    1318 syn keyword cType BoolInput
    13191319syn keyword cType BoolInput2
    13201320syn keyword cType BoolParam
     
    13281328syn keyword cType Contour
    13291329syn keyword cType Contours
    1330 syn keyword cType ControlInput
    13311330syn keyword cType ControlInput2
    13321331syn keyword cType Covertree
    1333 syn keyword cType DatasetInput
    13341332syn keyword cType DatasetInput2
    13351333syn keyword cType DataSetParam
    13361334syn keyword cType Definition
    13371335syn keyword cType DependentObject
    1338 syn keyword cType DoubleArrayInput
    1339 syn keyword cType DoubleInput
    13401336syn keyword cType DoubleMatArrayParam
    13411337syn keyword cType DoubleMatParam
     
    13661362syn keyword cType GiaDeflectionCoreArgs
    13671363syn keyword cType Hook
    1368 syn keyword cType Input
    13691364syn keyword cType Input2
    1370 syn keyword cType Inputs
    13711365syn keyword cType Inputs2
    1372 syn keyword cType IntInput
    13731366syn keyword cType IntInput2
    13741367syn keyword cType IntMatParam
     
    14091402syn keyword cType Penpair
    14101403syn keyword cType Penta
    1411 syn keyword cType PentaInput
    14121404syn keyword cType PentaInput2
    14131405syn keyword cType PentaRef
     
    14211413syn keyword cType RiftStruct
    14221414syn keyword cType Seg
    1423 syn keyword cType SegInput
    14241415syn keyword cType SegInput2
    14251416syn keyword cType Segment
     
    14321423syn keyword cType StringParam
    14331424syn keyword cType Tetra
    1434 syn keyword cType TetraInput
    14351425syn keyword cType TetraRef
    14361426syn keyword cType TransientArrayParam
    1437 syn keyword cType TransientInput
    14381427syn keyword cType TransientInput2
    14391428syn keyword cType TransientParam
    14401429syn keyword cType Tria
    1441 syn keyword cType TriaInput
    14421430syn keyword cType TriaInput2
    14431431syn keyword cType TriaRef
  • issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h

    r24335 r24398  
    629629        P0Enum,
    630630        P1Enum,
     631        PartitioningEnum,
    631632        PressureEnum,
    632633        RadarEnum,
  • issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp

    r24335 r24398  
    635635                case P0Enum : return "P0";
    636636                case P1Enum : return "P1";
     637                case PartitioningEnum : return "Partitioning";
    637638                case PressureEnum : return "Pressure";
    638639                case RadarEnum : return "Radar";
  • issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

    r24335 r24398  
    650650              else if (strcmp(name,"P0")==0) return P0Enum;
    651651              else if (strcmp(name,"P1")==0) return P1Enum;
     652              else if (strcmp(name,"Partitioning")==0) return PartitioningEnum;
    652653              else if (strcmp(name,"Pressure")==0) return PressureEnum;
    653654              else if (strcmp(name,"Radar")==0) return RadarEnum;
     
    751752              else if (strcmp(name,"SmbPrecipitationsLgm")==0) return SmbPrecipitationsLgmEnum;
    752753              else if (strcmp(name,"SmbPrecipitationsPresentday")==0) return SmbPrecipitationsPresentdayEnum;
    753               else if (strcmp(name,"SmbPrecipitationsReconstructed")==0) return SmbPrecipitationsReconstructedEnum;
    754754         else stage=7;
    755755   }
    756756   if(stage==7){
    757               if (strcmp(name,"SmbRe")==0) return SmbReEnum;
     757              if (strcmp(name,"SmbPrecipitationsReconstructed")==0) return SmbPrecipitationsReconstructedEnum;
     758              else if (strcmp(name,"SmbRe")==0) return SmbReEnum;
    758759              else if (strcmp(name,"SmbRefreeze")==0) return SmbRefreezeEnum;
    759760              else if (strcmp(name,"SmbReini")==0) return SmbReiniEnum;
     
    874875              else if (strcmp(name,"Outputdefinition31")==0) return Outputdefinition31Enum;
    875876              else if (strcmp(name,"Outputdefinition32")==0) return Outputdefinition32Enum;
    876               else if (strcmp(name,"Outputdefinition33")==0) return Outputdefinition33Enum;
    877877         else stage=8;
    878878   }
    879879   if(stage==8){
    880               if (strcmp(name,"Outputdefinition34")==0) return Outputdefinition34Enum;
     880              if (strcmp(name,"Outputdefinition33")==0) return Outputdefinition33Enum;
     881              else if (strcmp(name,"Outputdefinition34")==0) return Outputdefinition34Enum;
    881882              else if (strcmp(name,"Outputdefinition35")==0) return Outputdefinition35Enum;
    882883              else if (strcmp(name,"Outputdefinition36")==0) return Outputdefinition36Enum;
     
    997998              else if (strcmp(name,"Closed")==0) return ClosedEnum;
    998999              else if (strcmp(name,"Colinear")==0) return ColinearEnum;
    999               else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
    10001000         else stage=9;
    10011001   }
    10021002   if(stage==9){
    1003               if (strcmp(name,"Contact")==0) return ContactEnum;
     1003              if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
     1004              else if (strcmp(name,"Contact")==0) return ContactEnum;
    10041005              else if (strcmp(name,"Contour")==0) return ContourEnum;
    10051006              else if (strcmp(name,"Contours")==0) return ContoursEnum;
     
    11201121              else if (strcmp(name,"Internal")==0) return InternalEnum;
    11211122              else if (strcmp(name,"Intersect")==0) return IntersectEnum;
    1122               else if (strcmp(name,"InversionVzObs")==0) return InversionVzObsEnum;
    11231123         else stage=10;
    11241124   }
    11251125   if(stage==10){
    1126               if (strcmp(name,"J")==0) return JEnum;
     1126              if (strcmp(name,"InversionVzObs")==0) return InversionVzObsEnum;
     1127              else if (strcmp(name,"J")==0) return JEnum;
    11271128              else if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
    11281129              else if (strcmp(name,"L2ProjectionBaseAnalysis")==0) return L2ProjectionBaseAnalysisEnum;
     
    12431244              else if (strcmp(name,"SMBpdd")==0) return SMBpddEnum;
    12441245              else if (strcmp(name,"SMBpddSicopolis")==0) return SMBpddSicopolisEnum;
    1245               else if (strcmp(name,"SMBsemic")==0) return SMBsemicEnum;
    12461246         else stage=11;
    12471247   }
    12481248   if(stage==11){
    1249               if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
     1249              if (strcmp(name,"SMBsemic")==0) return SMBsemicEnum;
     1250              else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
    12501251              else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
    12511252              else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
  • issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp

    r24396 r24398  
    6060
    6161        /*create vwgt (Weight per node)*/
    62         idx_t* vwgts=xNew<idx_t>(numberofnodes);
    63         for(int i=0;i<numberofnodes;i++) vwgts[i]=1;
     62        idx_t* vwgts=NULL;
     63        if(vweights){
     64                vwgts=xNew<idx_t>(numberofnodes);
     65                for(int i=0;i<numberofnodes;i++) vwgts[i]=reCast<idx_t>(vweights[i]);
     66        }
    6467
    6568        /*Call METIS*/
Note: See TracChangeset for help on using the changeset viewer.