Ignore:
Timestamp:
12/07/10 11:28:12 (14 years ago)
Author:
jschierm
Message:

Added MassFlux calculation to Response module (among other changes).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/mex/Response/Response.cpp

    r6573 r6689  
    1616        char       *response   = NULL;
    1717        bool        process_units;
    18 
    19         /* output datasets: */
    20         double resp;
    2118
    2219        /*Boot module: */
     
    4138        loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
    4239
    43         /*!Call core code: */
    44         Responsex(&resp, elements,nodes,vertices, loads,materials,parameters,response,process_units);
     40        /*for MassFlux, loop over all profiles: */
     41        if (StringToEnum(response) == MassFluxEnum) {
     42                int  counter;
    4543
    46         /*write output : */
    47         WriteData(OUTPUT,resp);
     44                /*all segments: */
     45                double** array=NULL;
     46                int      M;
     47
     48                /* output datasets: */
     49                double*  resp;
     50
     51                /*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
     52                if(!parameters->FindParam(&array,&M,NULL,NULL,QmuMassFluxSegmentsEnum))_error_(" could not find QmuMassFluxSegmentsEnum");
     53
     54                /*Retrieve index of segments being used for MassFlux computation: */
     55//              if(!parameters->FindParam(&counter,IndexEnum))_error_(" could not find IndexEnum");
     56
     57                resp=(double*)xcalloc(M,sizeof(double));
     58                for (counter=0; counter<M; counter++) {
     59                        /*indexed response: plug index into parameters and call response module: */
     60                        parameters->SetParam(counter+1,IndexEnum);
     61
     62                        /*!Call core code: */
     63                        Responsex(&resp[counter], elements,nodes,vertices, loads,materials,parameters,response,process_units);
     64                }
     65
     66                /*write output : */
     67                WriteData(OUTPUT,resp,M);
     68//              WriteData does not copy data, so don't free (jes, 11/30/10)
     69//              xfree((void**)&resp);
     70        }
     71
     72        /*otherwise a single call: */
     73        else {
     74                /* output datasets: */
     75                double   resp;
     76
     77                /*!Call core code: */
     78                Responsex(&resp, elements,nodes,vertices, loads,materials,parameters,response,process_units);
     79
     80                /*write output : */
     81                WriteData(OUTPUT,resp);
     82        }
    4883
    4984        /*Free ressources: */
Note: See TracChangeset for help on using the changeset viewer.