00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <string.h>
00033
00034 #include "drv.h"
00035 #include "fem.h"
00036 #include "load.h"
00037 #include "elm.h"
00038 #include "node.h"
00039 #include "alg.h"
00040 #include "rio.h"
00041 #include "nfi.h"
00042 #include "load.h"
00043 #include "xgplib.h"
00044 #include "rui.h"
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 static void StandardNew(sDriver **);
00057 static void StandardFree(sDriver *);
00058 static int StandardAnalysis(UI_State *);
00059 static int StandardPrintResult(int, double *, double *);
00060
00061
00062
00063
00064
00065 static void StandardNew( sDriver **drv )
00066 {
00067
00068
00069 (*drv) = (sDriver *)calloc(1, sizeof(sDriver));
00070
00071
00072
00073 (*drv)->type = STANDARD;
00074
00075 }
00076
00077
00078
00079
00080
00081 static void StandardFree( sDriver *drv )
00082 {
00083
00084
00085 drv->data = 0L;
00086
00087 }
00088
00089
00090
00091
00092
00093
00094 static int StandardAnalysis(UI_State *R)
00095 {
00096 int i;
00097 double *FVector = 0L;
00098 double *UVector = 0L;
00099 double *VVector = 0L;
00100 double *MVector = 0L;
00101
00102
00103
00104 FVector = (double *)calloc(NDof*NumNodes, sizeof(double));
00105 UVector = (double *)calloc(NDof*NumNodes, sizeof(double));
00106 VVector = (double *)calloc(NDof*NumNodes, sizeof(double));
00107 MVector = (double *)calloc(NDof*NumNodes, sizeof(double));
00108
00109
00110
00111 PrescribedValues();
00112
00113
00114
00115 XGPBegin();
00116
00117
00118
00119 printf("\tSolve problem........................:\n");
00120 fflush(stdout);
00121
00122
00123
00124 if( !DRSolver(R, FVector, UVector, VVector, MVector, 0) ) return 0;
00125
00126
00127
00128 if( !IoStartSave() ) return 0;
00129
00130 fwrite(UVector, sizeof(double), NDof*NumNodes, ndlr);
00131 fflush(ndlr);
00132
00133 for( i = 0; i < NumElements; i++ )
00134 ElmWriteStress(ElmList[i], elmr, UVector, VVector);
00135 fflush(elmr);
00136
00137
00138
00139 XGPEnd();
00140
00141
00142
00143 free(FVector);
00144 free(UVector);
00145 free(VVector);
00146 free(MVector);
00147
00148 return 1;
00149
00150 }
00151
00152
00153
00154
00155
00156 static int StandardPrintResult( int iteration, double *U, double *V )
00157 {
00158 int i;
00159
00160
00161
00162 if( !Config.print_step || ((iteration != 1) && (iteration%Config.print_step)) )
00163 return 1;
00164
00165
00166
00167 Config.num_step++;
00168
00169
00170
00171 if( !IoStartSave( ) ) return 0;
00172
00173 fwrite( U, sizeof(double), NDof*NumNodes, ndlr );
00174 fflush( ndlr );
00175
00176 for( i = 0; i < NumElements; i++ )
00177 ElmWriteStress( ElmList[i], elmr, U, V );
00178 fflush( elmr );
00179
00180 return 1;
00181
00182 }
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 void StandardInit( void );
00194 void StandardInit( void )
00195 {
00196
00197
00198 DrvClass[STANDARD].new = StandardNew;
00199 DrvClass[STANDARD].free = StandardFree;
00200 DrvClass[STANDARD].analysis = StandardAnalysis;
00201 DrvClass[STANDARD].printres = StandardPrintResult;
00202
00203 }
00204
00205
00206
00207