Changeset 3452


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

added CreateConstraints for Balancedvelocities, Balancedthickness and Prognostic

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateConstraintsBalancedthickness.cpp

    r3442 r3452  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateConstraintsBalancedthickness(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
    14 
    1513
    1614        int i;
     
    2422        IoModelFetchData(&iomodel->spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
    2523
    26         count=1;
     24        count=1; //matlab indexing
    2725        /*Create spcs from x,y,z, as well as the spc values on those spcs: */
    2826        for (i=0;i<iomodel->numberofvertices;i++){
  • issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp

    r3446 r3452  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateConstraintsBalancedvelocities(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1413
    15 
    1614        int i;
    17         int count;
     15        int count=1;
    1816       
    1917        DataSet* constraints = NULL;
     
    2119
    2220        /*spc intermediary data: */
    23         int spc_sid;
    24         int spc_node;
    25         int spc_dof;
    26         double spc_value;
    27        
    2821        double* spcvelocity=NULL;
    2922       
     
    3427        IoModelFetchData(&spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity");
    3528
    36         count=0;
    37 
     29        count=1; //matlab indexing
    3830        /*Create spcs from x,y,z, as well as the spc values on those spcs: */
    3931        for (i=0;i<iomodel->numberofvertices;i++){
    40         #ifdef _PARALLEL_
    41         /*keep only this partition's nodes:*/
    42         if((iomodel->my_vertices[i]==1)){
    43         #endif
     32                /*keep only this partition's nodes:*/
     33                if((iomodel->my_vertices[i]==1)){
    4434
    45                 if ((int)spcvelocity[6*i+0] && (int)spcvelocity[6*i+1]){ //spc if vx and vy are constrained
    46        
    47                         /*This grid needs to be spc'd: */
    48                         spc_sid=count;
    49                         spc_node=i+1;
    50                         spc_dof=1; //we enforce first translation degree of freedom, for temperature
    51                         spc_value=pow( pow(*(spcvelocity+6*i+4),2.0) + pow(*(spcvelocity+6*i+5),2.0) ,0.5);
     35                        if ((int)spcvelocity[6*i+0] && (int)spcvelocity[6*i+1]){ //spc if vx and vy are constrained
    5236
    53                         spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
    54                         constraints->AddObject(spc);
    55                         count++;
    56                 }
     37                                /*This grid needs to be spc'd: */
     38                                constraints->AddObject(new Spc(count,i+1,1,pow( pow(*(spcvelocity+6*i+4),2.0) + pow(*(spcvelocity+6*i+5),2.0) ,0.5)));
     39                                count++;
     40                        }
    5741
    58         #ifdef _PARALLEL_
    59         } //if((my_vertices[i]==1))
    60         #endif
     42                } //if((my_vertices[i]==1))
    6143        }
    6244
  • issm/trunk/src/c/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp

    r3446 r3452  
    22 * CreateConstraintsPrognostic.c:
    33 */
    4 
    54
    65#include "../../DataSet/DataSet.h"
     
    1110#include "../IoModel.h"
    1211
    13 
    1412void    CreateConstraintsPrognostic(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1513
    16 
    1714        int i;
    18         int count;
     15        int count=0;
    1916       
    2017        DataSet* constraints = NULL;
     
    2219
    2320        /*spc intermediary data: */
    24         int spc_sid;
    25         int spc_node;
    26         int spc_dof;
    27         double spc_value;
    28        
    2921        double* spcthickness=NULL;
    3022       
     
    3527        IoModelFetchData(&spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
    3628
    37         count=0;
    38 
     29        count=1;//matlab indexing
    3930        /*Create spcs from x,y,z, as well as the spc values on those spcs: */
    4031        for (i=0;i<iomodel->numberofvertices;i++){
    41         #ifdef _PARALLEL_
    42         /*keep only this partition's nodes:*/
    43         if((iomodel->my_vertices[i]==1)){
    44         #endif
     32                /*keep only this partition's nodes:*/
     33                if((iomodel->my_vertices[i]==1)){
    4534
    46                 if ((int)spcthickness[2*i]){
    47        
    48                         /*This grid needs to be spc'd: */
     35                        if ((int)spcthickness[2*i]){
    4936
    50                         spc_sid=count;
    51                         spc_node=i+1;
    52                         spc_dof=1; //we enforce first translation degree of freedom, for temperature
    53                         spc_value=*(spcthickness+2*i+1);
     37                                constraints->AddObject(new Spc(count,i+1,1,*(spcthickness+2*i+1)));
     38                                count++;
     39                        }
    5440
    55                         spc = new Spc(spc_sid,spc_node,spc_dof,spc_value);
    56                         constraints->AddObject(spc);
    57                         count++;
    58                 }
    59 
    60         #ifdef _PARALLEL_
    61         } //if((my_vertices[i]==1))
    62         #endif
     41                } //if((my_vertices[i]==1))
    6342        }
    6443
Note: See TracChangeset for help on using the changeset viewer.