Changeset 2283


Ignore:
Timestamp:
09/23/09 12:04:10 (15 years ago)
Author:
Mathieu Morlighem
Message:

Adde vertical spcs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp

    r1834 r2283  
    1616void    CreateConstraintsDiagnosticVert(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1717
     18        int i;
     19        int count;
    1820
    1921        DataSet* constraints = NULL;
     22        Spc*    spc  = NULL;
     23
     24        /*spc intermediary data: */
     25        int spc_sid;
     26        int spc_node;
     27        int spc_dof;
     28        double spc_value;
     29
     30        double* spcvelocity=NULL;
    2031
    2132        /*Create constraints: */
    2233        constraints = new DataSet(ConstraintsEnum());
    2334
    24         /*Now, is the iomodel running in 3d? : */
     35        /*return if 2d mesh*/
    2536        if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
    26        
    27         cleanup_and_return:     
     37
     38        /*Fetch data: */
     39        IoModelFetchData((void**)&spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity","Matrix","Mat");
     40
     41        count=0;
     42
     43        /*Create spcs from x,y,z, as well as the spc values on those spcs: */
     44        for (i=0;i<iomodel->numberofnodes;i++){
     45      #ifdef _PARALLEL_
     46                /*keep only this partition's nodes:*/
     47                if((iomodel->my_grids[i]==1)){
     48      #endif
     49
     50                        if ((int)spcvelocity[6*i+2]){
     51
     52                                /*This grid needs to be spc'd to vx_obs and vy_obs:*/
     53
     54                                spc_sid=count;
     55                                spc_node=i+1;
     56                                spc_dof=1; //we enforce first translation degree of freedom, for velocity
     57                                spc_value=spcvelocity[6*i+5];
     58
     59                                spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
     60                                constraints->AddObject(spc);
     61                                count++;
     62
     63                        }
     64
     65      #ifdef _PARALLEL_
     66                } //if((my_grids[i]==1))
     67      #endif
     68        }
     69
     70        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
     71         * datasets, it will not be redone: */
     72        constraints->Presort();
     73
     74        cleanup_and_return:
     75
     76        /*Free data: */
     77        xfree((void**)&spcvelocity);
    2878       
    2979        /*Assign output pointer: */
Note: See TracChangeset for help on using the changeset viewer.