Changeset 3456


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

more cleaning on ModelProcessor

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp

    r3452 r3456  
    1818        Spc*    spc  = NULL;
    1919
    20         /*spc intermediary data: */
    21         double* spcvelocity=NULL;
    22        
    2320        /*Create constraints: */
    2421        constraints = new DataSet(ConstraintsEnum());
    2522
    2623        /*Fetch data: */
    27         IoModelFetchData(&spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity");
     24        IoModelFetchData(&iomodel->spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity");
    2825
    2926        count=1; //matlab indexing
     
    3330                if((iomodel->my_vertices[i]==1)){
    3431
    35                         if ((int)spcvelocity[6*i+0] && (int)spcvelocity[6*i+1]){ //spc if vx and vy are constrained
     32                        if ((int)iomodel->spcvelocity[6*i+0] && (int)iomodel->spcvelocity[6*i+1]){ //spc if vx and vy are constrained
    3633
    3734                                /*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)));
     35                                constraints->AddObject(new Spc(count,i+1,1,pow( pow(*(iomodel->spcvelocity+6*i+4),2.0) + pow(*(iomodel->spcvelocity+6*i+5),2.0) ,0.5)));
    3936                                count++;
    4037                        }
     
    4340        }
    4441
     42        /*Free data: */
     43        xfree((void**)&iomodel->spcvelocity);
     44       
    4545        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
    4646         * datasets, it will not be redone: */
    4747        constraints->Presort();
    4848
    49         /*Free data: */
    50         xfree((void**)&spcvelocity);
    51        
    5249        cleanup_and_return:
    5350       
  • issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp

    r3332 r3456  
    11/*! \file CreateLoadsDiagnosticHutter.c:
    22 */
    3 
    43
    54#include "../../DataSet/DataSet.h"
     
    109#include "../../include/macros.h"
    1110#include "../IoModel.h"
    12 
    1311
    1412void    CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
  • issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp

    r3454 r3456  
    1515        DataSet* constraints = NULL;
    1616        Spc*    spc  = NULL;
    17         int count;
    18 
    19         /*spc intermediary data: */
    20         double* gridonstokes=NULL;
     17        int count=0;
    2118
    2219        /*Create constraints: */
     
    2724
    2825        /*Fetch data: */
    29         IoModelFetchData(&gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes");
     26        IoModelFetchData(&iomodel->gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes");
    3027
    3128        count=1; //matlab indexing
     
    3532                if((iomodel->my_vertices[i]==1)){
    3633
    37                         if ((int)!gridonstokes[i]){
     34                        if ((int)!iomodel->gridonstokes[i]){
    3835
    3936                                /*This grid will see its vx,vy and vz dofs spc'd to pattyn velocities: */
     
    5047        }
    5148
     49        /*Free data: */
     50        xfree((void**)&iomodel->gridonstokes);
     51
    5252        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
    5353         * datasets, it will not be redone: */
    5454        constraints->Presort();
    55 
    56         /*Free data: */
    57         xfree((void**)&gridonstokes);
    5855
    5956        cleanup_and_return:
  • issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp

    r3446 r3456  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
    14 
    1513
    1614        int i;
    1715       
    1816        DataSet*    loads    = NULL;
    19         Icefront*   icefront = NULL;
    2017        Pengrid*    pengrid  = NULL;
    2118
     
    2421
    2522        /*pengrid intermediary data: */
    26         int pengrid_id;
    27         int pengrid_mparid;
    28         int pengrid_node_id;
    29         int pengrid_dof;
    30         double pengrid_penalty_offset;
    31         int pengrid_active=0;
    32         int pengrid_thermal_steadystate=1;
    33         int pengrid_stabilize_constraints=0;
    34 
    3523        int numberofpressureloads;
    36         int count;
    37 
     24        int count=0;
    3825
    3926        /*Create loads: */
     
    5037        IoModelFetchData(&iomodel->bed,NULL,NULL,iomodel_handle,"bed");
    5138
    52         count=0;
    53 
     39        count=1; //matlab indexing
    5440        /*First load data:*/
    5541        for (i=0;i<numberofpressureloads;i++){
     
    8470       
    8571        for (i=0;i<iomodel->numberofvertices;i++){
    86         #ifdef _PARALLEL_
    87         /*keep only this partition's nodes:*/
    88         if((iomodel->my_vertices[i]==1)){
    89         #endif
     72                /*keep only this partition's nodes:*/
     73                if((iomodel->my_vertices[i]==1)){
    9074
    91                 if ((iomodel->gridonbed[i]) && (iomodel->gridonicesheet[i]) && (iomodel->gridonstokes[i])){
     75                        if ((iomodel->gridonbed[i]) && (iomodel->gridonicesheet[i]) && (iomodel->gridonstokes[i])){
    9276
    93                         pengrid_id=count+1; //matlab indexing
    94                         pengrid_node_id=i+1;
    95                         pengrid_dof=1;
    96                         pengrid_penalty_offset=iomodel->penalty_offset;
    97                         pengrid_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
    98                         pengrid_stabilize_constraints=iomodel->stabilize_constraints;
    99                         pengrid= new Pengrid(pengrid_id, pengrid_node_id,pengrid_mparid,pengrid_dof, pengrid_active, pengrid_penalty_offset,pengrid_thermal_steadystate,pengrid_stabilize_constraints);
    100                        
    101                         loads->AddObject(pengrid);
    102                         count++;
    103                 }
    104         #ifdef _PARALLEL_
    105         } //if((iomodel->my_vertices[i]==1))
    106         #endif
     77                                loads->AddObject(new Pengrid(count+1, i+1,iomodel->numberofelements+1,1, 0, iomodel->penalty_offset,1,iomodel->stabilize_constraints));
     78                                count++;
     79                        }
     80                } //if((iomodel->my_vertices[i]==1))
    10781        }
    10882
  • issm/trunk/src/c/ModelProcessorx/Melting/CreateConstraintsMelting.cpp

    r3332 r3456  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateConstraintsMelting(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
    14 
    1513
    1614        int i;
  • issm/trunk/src/c/ModelProcessorx/Melting/CreateLoadsMelting.cpp

    r3450 r3456  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateLoadsMelting(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1413
    1514        int i;
    16         int element;
     15        int count=0;
    1716
    18         extern int my_rank;
    19         extern int num_procs;
    20        
    2117        DataSet*    loads    = NULL;
    22 
    23         /*pengrid intermediary data: */
    24         int pengrid_thermal_steadystate=1;
    25         int count=0;
    2618
    2719        /*if 2d: return*/
     
    4133                        if (iomodel->gridonbed[i]){
    4234
    43                                 loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1, 1, 0, iomodel->penalty_offset, pengrid_thermal_steadystate, iomodel->stabilize_constraints));
    44 
     35                                loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1, 1, 0, iomodel->penalty_offset, 1, iomodel->stabilize_constraints));
    4536                                count++;
    4637                        }
  • issm/trunk/src/c/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp

    r3452 r3456  
    1818        Spc*    spc  = NULL;
    1919
    20         /*spc intermediary data: */
    21         double* spcthickness=NULL;
    22        
    2320        /*Create constraints: */
    2421        constraints = new DataSet(ConstraintsEnum());
    2522
    2623        /*Fetch data: */
    27         IoModelFetchData(&spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
     24        IoModelFetchData(&iomodel->spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
    2825
    2926        count=1;//matlab indexing
     
    3330                if((iomodel->my_vertices[i]==1)){
    3431
    35                         if ((int)spcthickness[2*i]){
     32                        if ((int)iomodel->spcthickness[2*i]){
    3633
    37                                 constraints->AddObject(new Spc(count,i+1,1,*(spcthickness+2*i+1)));
     34                                constraints->AddObject(new Spc(count,i+1,1,*(iomodel->spcthickness+2*i+1)));
    3835                                count++;
    3936                        }
    40 
    4137                } //if((my_vertices[i]==1))
    4238        }
    4339
     40        /*Free data: */
     41        xfree((void**)&iomodel->spcthickness);
     42       
    4443        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
    4544         * datasets, it will not be redone: */
    4645        constraints->Presort();
    4746
    48         /*Free data: */
    49         xfree((void**)&spcthickness);
    50        
    5147        cleanup_and_return:
    5248       
  • issm/trunk/src/c/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp

    r3332 r3456  
    11/*! \file CreateLoadsPrognostic.c:
    22 */
    3 
    43
    54#include "../../DataSet/DataSet.h"
     
    1110#include "../IoModel.h"
    1211
    13 
    1412void    CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1513
     
    1816        /*Create loads: */
    1917        loads   = new DataSet(LoadsEnum());
    20        
    2118       
    2219        /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these
  • issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp

    r3359 r3456  
    22 * CreateConstraintsSlopeCompute.c:
    33 */
    4 
    54
    65#include "../../DataSet/DataSet.h"
     
    109#include "../../shared/shared.h"
    1110#include "../IoModel.h"
    12 
    1311
    1412void    CreateConstraintsSlopeCompute(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
  • issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp

    r3332 r3456  
    11/*! \file CreateLoadsSlopeCompute.c:
    22 */
    3 
    43
    54#include "../../DataSet/DataSet.h"
     
    109#include "../../include/macros.h"
    1110#include "../IoModel.h"
    12 
    1311
    1412void    CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
  • issm/trunk/src/c/ModelProcessorx/Thermal/CreateLoadsThermal.cpp

    r3450 r3456  
    1010#include "../IoModel.h"
    1111
    12 
    1312void    CreateLoadsThermal(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
    1413
    1514        int i;
     15        int count=0;
    1616
    1717        DataSet*    loads    = NULL;
    1818        Pengrid*    pengrid  = NULL;
    19 
    20         /*pengrid intermediary data: */
    21         int pengrid_thermal_steadystate=1;
    22 
    23         int count=0;
    2419
    2520        /*return if 2d mesh*/
     
    3934                        if (!iomodel->spctemperature[2*i]){ //No penalty applied on spc grids!
    4035
    41                                 loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1,1, 0, iomodel->penalty_offset,pengrid_thermal_steadystate,iomodel->stabilize_constraints));
    42 
     36                                loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1,1, 0, iomodel->penalty_offset,1,iomodel->stabilize_constraints));
    4337                                count++;
    4438                        }
Note: See TracChangeset for help on using the changeset viewer.