00001 /* 00002 %M This module contains the Main driver for the Relax program. 00003 %a Joao Luiz Elias Campos. 00004 %d September 2nd, 1998. 00005 %r $Id: main.c,v 1.1 2004/06/22 05:29:59 joaoluiz Exp $ 00006 %w (C) COPYRIGHT 1995-1996, Eduardo Nobre Lages. 00007 (C) COPYRIGHT 1997-1999, Joao Luiz Elias Campos. 00008 All Rights Reserved 00009 Duplication of this program or any part thereof without the express 00010 written consent of the author is prohibited. 00011 * 00012 * Modified: 08-Aug-05 Alexandre A. Del Savio 00013 * Criada a funcao RelaxInit e modificada o nome da funcao 00014 * main para RelaxRun. 00015 * 00016 * Modified: 13-Sep-05 Alexandre A. Del Savio 00017 * Criada a funcao RelaxReset. 00018 * 00019 * Modified: 16-Dez-05 Juan Pablo Ibañez 00020 * Modificada a função RelaxInit, onde incluiu-se o parâmetro delta 00021 * na função count_it. 00022 * 00023 * Modified: 09-Jan-06 Juan Pablo Ibañez 00024 * Modificada a função RelaxInit, onde incluiu-se como parâmetro 00025 * o ponteiro de função fposgauge para atualização do gauge de 00026 * geração do arquivo relax.pos. 00027 * 00028 * Modified: 22-Fev-06 Juan Pablo Ibañez 00029 * Modificada a funcão RelaxRun, onde incluiu-se o retorno ao Recon 00030 * no caso de erro durante a rodagem do Relax. 00031 */ 00032 00033 /* 00034 ** ------------------------------------------------------------------------ 00035 ** Global variables and symbols: 00036 */ 00037 #include <stdio.h> 00038 #include <time.h> 00039 00040 #include "relax.h" 00041 #include "rui.h" 00042 #include "rio.h" 00043 #include "drv.h" 00044 #include "alg.h" 00045 #include "nfi.h" 00046 00047 00048 /* 00049 ** ------------------------------------------------------------------------ 00050 ** Local variables and symbols: 00051 */ 00052 00053 /* 00054 ** ------------------------------------------------------------------------ 00055 ** Local functions: 00056 */ 00057 00058 /* 00059 ** ------------------------------------------------------------------------ 00060 ** Public functions: 00061 */ 00062 00063 /* 00064 %F This function is the Main driver for the Relax program. 00065 */ 00066 #if 0 00067 int main( int argc, char *argv[] ) 00068 #else 00069 int RelaxRun( int argc, char *argv[] ) 00070 #endif 00071 { 00072 unsigned long int i_time = time( NULL ); 00073 #if 1 00074 UI_State *R = NULL; 00075 #endif 00076 00077 /* Open input file 00078 */ 00079 if( !IoOpenFiles(argc, argv) ) return 0; 00080 00081 /* Read input and output files 00082 */ 00083 if( !IoReadFile() ) return 0; 00084 00085 /* Start user interface. 00086 */ 00087 #if 0 00088 R = UIStart(argc, argv); 00089 #endif 00090 00091 /* Process analysis 00092 */ 00093 if( !DrvAnalysis(R, DrvObj) ) return 0; 00094 00095 /* Write result file 00096 */ 00097 00098 if( !IoWriteFile() ) return 0; 00099 00100 printf( "\n\tTotal analysis time...........: %lu segs\n\n", (time(NULL)-i_time) ); 00101 00102 /* Close all files 00103 */ 00104 IoCloseFiles(); 00105 00106 return 1; 00107 00108 } /*End of Main */ 00109 00110 00111 /* 00112 ** Função de atualização do gauge durante a análise. 00113 */ 00114 00115 void RelaxInit ( void(*count_it)(int n_iter, double err, int loadstep), 00116 void(*fposgauge)(double gauge),void(*fstop)(int *stop) ) 00117 { 00118 _count_it = count_it; 00119 _fposgauge = fposgauge; 00120 _fstop = fstop; 00121 } 00122 00123 /* 00124 ** Reset Relax. 00125 */ 00126 00127 void RelaxReset( void ) 00128 { 00129 AlgReset(); 00130 IoReset(); 00131 } 00132 00133 00134 /* ======================================================= End of File */ 00135