Changeset 3455


Ignore:
Timestamp:
04/08/10 08:15:47 (15 years ago)
Author:
seroussi
Message:

added CreateConstraints for Hutter

Location:
issm/trunk/src/c/ModelProcessorx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp

    r3446 r3455  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateConstraintsDiagnosticHutter(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1413
    15         int i,j;
    16         int count;
     14        int i;
     15        int count=0;
    1716
    1817        DataSet* constraints = NULL;
     18        Spc*    spc  = NULL;
    1919
    20         Spc*    spc  = NULL;
    21         Rgb*    rgb  = NULL;
    22 
    23         /*spc intermediary data: */
    24         int spc_sid;
    25         int spc_node;
    26         int spc_dof;
    27         double spc_value;
    28 
    29         /*rgb constructor data: */
    30         int rgb_id;
    31         int rgb_dof;
    32         int rgb_nodeid1;
    33         int rgb_nodeid2;
     20        /*Now, is the flag ishutter on? otherwise, do nothing: */
     21        if (!iomodel->ishutter)goto cleanup_and_return;
    3422
    3523        /*Create constraints: */
    3624        constraints = new DataSet(ConstraintsEnum());
    3725
    38         /*Now, is the flag ishutter on? otherwise, do nothing: */
    39         if (!iomodel->ishutter)goto cleanup_and_return;
    40 
    41         count=0;
    42        
    4326        /*Fetch data: */
    4427        IoModelFetchData(&iomodel->gridonhutter,NULL,NULL,iomodel_handle,"gridonhutter");
    4528
     29        count=1; //matlab indexing
    4630        /*vx and vy are spc'd if we are not on gridonhutter: */
    4731        for (i=0;i<iomodel->numberofvertices;i++){
    48         #ifdef _PARALLEL_
    49         /*keep only this partition's nodes:*/
    50         if((iomodel->my_vertices[i])){
    51         #endif
     32                /*keep only this partition's nodes:*/
     33                if((iomodel->my_vertices[i])){
     34                        if (!(int)iomodel->gridonhutter[i]){
    5235
    53                 if (!(int)iomodel->gridonhutter[i]){
    54        
    55                         spc_sid=count;
    56                         spc_node=i+1;
    57                         spc_dof=1; //we enforce first x translation degree of freedom
    58                         spc_value=0;
     36                                constraints->AddObject(new Spc(count,i+1,1,0));
     37                                count++;
    5938
    60                         spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
    61                         constraints->AddObject(spc);
    62                         count++;
    63 
    64                         spc_sid=count;
    65                         spc_node=i+1;
    66                         spc_dof=2; //we enforce first y translation degree of freedom
    67                         spc_value=0;
    68                        
    69                         spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
    70                         constraints->AddObject(spc);
    71                         count++;
    72                 }
    73 
    74         #ifdef _PARALLEL_
    75         } //if((my_vertices[i]))
    76         #endif
     39                                constraints->AddObject(new Spc(count,i+1,2,0));
     40                                count++;
     41                        }
     42                } //if((my_vertices[i]))
    7743        }
    7844
  • issm/trunk/src/c/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp

    r3450 r3455  
    1818        Spc*    spc  = NULL;
    1919
    20         double* spctemperature=NULL;
    21        
    2220        /*Create constraints: */
    2321        constraints = new DataSet(ConstraintsEnum());
     
    2725
    2826        /*Fetch data: */
    29         IoModelFetchData(&spctemperature,NULL,NULL,iomodel_handle,"spctemperature");
     27        IoModelFetchData(&iomodel->spctemperature,NULL,NULL,iomodel_handle,"spctemperature");
    3028
    3129        count=1;
     
    3634                if((iomodel->my_vertices[i]==1)){
    3735
    38                         if ((int)spctemperature[2*i]){
     36                        if ((int)iomodel->spctemperature[2*i]){
    3937
    40                                 constraints->AddObject(new Spc(count,i+1,1,spctemperature[2*i+1]));
     38                                constraints->AddObject(new Spc(count,i+1,1,iomodel->spctemperature[2*i+1]));
    4139                                count++;
    4240
     
    4644        }
    4745
     46        /*Free data: */
     47        xfree((void**)&iomodel->spctemperature);
     48
    4849        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
    4950         * datasets, it will not be redone: */
     
    5152
    5253        cleanup_and_return:
    53         /*Free data: */
    54         xfree((void**)&spctemperature);
    5554       
    5655        /*Assign output pointer: */
Note: See TracChangeset for help on using the changeset viewer.