Ignore:
Timestamp:
07/29/10 10:07:56 (15 years ago)
Author:
Mathieu Morlighem
Message:

outputfile is now loaded step by step to save memory. the file is open once and closed at the end of the solution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/solutions/issm.cpp

    r4574 r4873  
    1212
    1313        /*I/O: */
    14         FILE     *fid              = NULL;
     14        FILE     *input_fid        = NULL;
     15        FILE     *output_fid       = NULL;
    1516        char     *inputfilename    = NULL;
    1617        char     *outputfilename   = NULL;
     
    4849        MPI_Comm_size(MPI_COMM_WORLD,&num_procs);
    4950
    50         _printf_("recover input and output file names:\n");
     51        _printf_("recover solution and file names:\n");
    5152        solution_type=StringAsEnum(argv[1]);
    5253        inputfilename=argv[3];
     
    6061        SolutionConfiguration(&analyses,&numanalyses,&solutioncore,solution_type);
    6162
    62         /*Open handle to data on disk: */
    63         fid=pfopen(inputfilename,"rb");
     63        /*Open input file to process model
     64         * and ouput file to start unload results*/
     65        input_fid =pfopen(inputfilename ,"rb");
     66        output_fid=pfopen(outputfilename,"wb");
    6467
    6568        _printf_("create finite element model:\n");
    66         femmodel=new FemModel(fid,solution_type,analyses,numanalyses);
     69        femmodel=new FemModel(input_fid,solution_type,analyses,numanalyses);
    6770
    68         /*add outputfilename in parameters: */
    69         femmodel->parameters->AddObject(new StringParam(OutputFileNameEnum,outputfilename));
     71        /*add output_fid to parameters: */
     72        femmodel->parameters->SetParam(output_fid,OutputFilePointerEnum);
    7073       
    7174        /*get parameters: */
     
    9699
    97100                _printf_("write results to disk:\n");
    98                 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
     101                OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
    99102        }
    100103        else{
     
    111114        }
    112115
     116        /*Close output file and write lock file if requested*/
     117        pfclose(output_fid,outputfilename);
    113118        if (waitonlock>0){
    114119                _printf_("write lock file:\n");
Note: See TracChangeset for help on using the changeset viewer.