CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
exo.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void exo (double *co, ITG *nk, ITG *kon, ITG *ipkon, char *lakon, ITG *ne0, double *v, double *stn, ITG *inum, ITG *nmethod, ITG *kode, char *filab, double *een, double *t1, double *fn, double *time, double *epn, ITG *ielmat, char *matname, double *enern, double *xstaten, ITG *nstate_, ITG *istep, ITG *iinc, ITG *ithermal, double *qfn, ITG *mode, ITG *noddiam, double *trab, ITG *inotr, ITG *ntrans, double *orab, ITG *ielorien, ITG *norien, char *description, ITG *ipneigh, ITG *neigh, ITG *mi, double *stx, double *vr, double *vi, double *stnr, double *stni, double *vmax, double *stnmax, ITG *ngraph, double *veold, double *ener, ITG *ne, double *cs, char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, double *eenmax, double *fnr, double *fni, double *emn, double *thicke, char *jobnamec, char *output, double *qfx, double *cdn, ITG *mortar, double *cdnr, double *cdni, ITG *nmat)
 
void exosetfind (char *set, ITG *nset, ITG *ialset, ITG *istartset, ITG *iendset, ITG *num_ns, ITG *num_ss, ITG *num_es, ITG *num_fs, ITG *node_map_inv, int exoid, int store, ITG *nk)
 
ITG exoset_check (ITG n, ITG *node_map_inv, ITG *nk, int *dropped, int *unidentified)
 
void exovector (double *v, ITG *iset, ITG *ntrans, char *filabl, ITG *nkcoords, ITG *inum, char *m1, ITG *inotr, double *trab, double *co, ITG *istartset, ITG *iendset, ITG *ialset, ITG *mi, ITG *ngraph, FILE *f1, char *output, char *m3, int exoid, ITG time_step, int countvar, ITG nout)
 
void exoselect (double *field1, double *field2, ITG *iset, ITG *nkcoords, ITG *inum, ITG *istartset, ITG *iendset, ITG *ialset, ITG *ngraph, ITG *ncomp, ITG *ifield, ITG *icomp, ITG *nfield, ITG *iselect, ITG exoid, ITG time_step, int countvar, ITG nout)
 

Function Documentation

◆ exo()

void exo ( double *  co,
ITG nk,
ITG kon,
ITG ipkon,
char *  lakon,
ITG ne0,
double *  v,
double *  stn,
ITG inum,
ITG nmethod,
ITG kode,
char *  filab,
double *  een,
double *  t1,
double *  fn,
double *  time,
double *  epn,
ITG ielmat,
char *  matname,
double *  enern,
double *  xstaten,
ITG nstate_,
ITG istep,
ITG iinc,
ITG ithermal,
double *  qfn,
ITG mode,
ITG noddiam,
double *  trab,
ITG inotr,
ITG ntrans,
double *  orab,
ITG ielorien,
ITG norien,
char *  description,
ITG ipneigh,
ITG neigh,
ITG mi,
double *  stx,
double *  vr,
double *  vi,
double *  stnr,
double *  stni,
double *  vmax,
double *  stnmax,
ITG ngraph,
double *  veold,
double *  ener,
ITG ne,
double *  cs,
char *  set,
ITG nset,
ITG istartset,
ITG iendset,
ITG ialset,
double *  eenmax,
double *  fnr,
double *  fni,
double *  emn,
double *  thicke,
char *  jobnamec,
char *  output,
double *  qfx,
double *  cdn,
ITG mortar,
double *  cdnr,
double *  cdni,
ITG nmat 
)
45  {
46 
47  /* stores the results in exo format
48 
49  iselect selects which nodes are to be stored:
50  iselect=-1 means only those nodes for which inum negative
51  ist, i.e. network nodes
52  iselect=+1 means only those nodes for which inum positive
53  ist, i.e. structural nodes
54  iselect=0 means both of the above */
55 
56  /* Note for frd strcmp1(output,"asc")==0 defines ascii file, otherwise binary */
57 
58  char fneig[132]="",
59  material[59]=" ",
60  text[2]=" ";
61 
62  /* For call compatibility with frd */
63  char m1[4]="";
64  char m3[4]="";
65  FILE *f1=NULL;
66 
67  static ITG nkcoords,nout,noutmin,noutplus,iaxial;
68  ITG nterms;
69 
70  ITG i,j,k,l,m,n,o,indexe,nemax,nlayer,noutloc,iset,iselect,ncomp,nope,
71  nodes,ifield[7],nfield[2],icomp[7],ifieldstate[*nstate_],icompstate[*nstate_],nelout;
72 
73  ITG mt=mi[1]+1;
74 
75  ITG ncompscalar=1,ifieldscalar[1]={1},icompscalar[1]={0},nfieldscalar[2]={1,0};
76  ITG ncompvector=3,ifieldvector[3]={1,1,1},icompvector[3]={0,1,2},nfieldvector1[2]={3,0},nfieldvector0[2]={mi[1]+1,0},icompvectorlast[3]={3,4,5};
77  ITG ncomptensor=6,ifieldtensor[6]={1,1,1,1,1,1},icomptensor[6]={0,1,2,3,5,4},nfieldtensor[2]={6,0};
78  ITG ncompscalph=2,ifieldscalph[2]={1,2},icompscalph[2]={0,0},nfieldscalph[2]={0,0};
79  ITG ncompvectph=6,ifieldvectph[6]={1,1,1,2,2,2},icompvectph[6]={1,2,3,1,2,3},nfieldvectph[2]={mi[1]+1,mi[1]+1};
80  ITG ncomptensph=12,ifieldtensph[12]={1,1,1,1,1,1,2,2,2,2,2,2},icomptensph[12]={0,1,2,3,5,4,0,1,2,3,5,4},nfieldtensph[2]={6,6};
81 
82  double *vold=NULL;
83 
84  int errr=0, exoid=0;
85  ITG num_dim, num_elem;
86  ITG num_elem_blk; /* Node element blocks. One eltype per block*/
87  ITG num_ns, num_ss, num_es, num_fs; /* Node sets, side sets, element sets, face sets */
88  int CPU_word_size = sizeof(float);
89  int IO_word_size = sizeof(float);
90 
91  /* Filename */
92  strcpy (fneig, jobnamec);
93  strcat (fneig, ".exo");
94 
95  /* nkcoords is the number of nodes at the time when
96  the nodal coordinates are stored in the exo file */
97  nkcoords = *nk;
98  ITG num_nodes = nkcoords;
99 
100  /* determining nout, noutplus and noutmin
101  nout: number of structural and network nodes
102  noutplus: number of structural nodes
103  noutmin: number of network nodes */
104  if(*nmethod!=0){
105  nout=0;
106  noutplus=0;
107  noutmin=0;
108  for(i=0;i<*nk;i++){
109  if(inum[i]==0) continue;
110  if(inum[i]>0) noutplus++;
111  if(inum[i]<0) noutmin++;
112  nout++;
113  }
114  }else{
115  nout=*nk;
116  }
117 
118  // Allocate memory for node positions
119  float *x, *y, *z;
120  x = (float *) calloc(nout, sizeof(float));
121  y = (float *) calloc(nout, sizeof(float));
122  z = (float *) calloc(nout, sizeof(float));
123 
124  // Write optional node map
125  j = 0; // Counter for the exo order of the nodes
126  ITG *node_map,*node_map_inv;
127  node_map = (ITG *) calloc(nout, sizeof(ITG));
128  node_map_inv = (ITG *) calloc(nkcoords, sizeof(ITG));
129  /* storing the coordinates of the nodes */
130  if(*nmethod!=0){
131  for(i=0;i<*nk;i++){
132  if(inum[i]==0){continue;}
133  // The difference between i and j is that not all values of i
134  // increment j.
135  node_map[j] = i+1;
136  node_map_inv[i] = j+1;
137  x[j] = co[3*i];
138  y[j] = co[3*i+1];
139  z[j++] = co[3*i+2];
140  }
141  }else{
142  for(i=0;i<*nk;i++){
143  node_map[j] = i+1;
144  node_map_inv[i] = j+1;
145  x[j] = co[3*i];
146  y[j] = co[3*i+1];
147  z[j++] = co[3*i+2];
148  }
149  }
150 
151  /* first time something is written in the exo-file: store
152  computational metadata, the nodal coordinates and the
153  topology */
154  if((*kode==1)&&((*nmethod!=5)||(*mode!=0))){
155  iaxial=0.;
156  num_dim = 3;
157  num_elem_blk = 19;
158 
159  // Find the number of sets
160  exosetfind(set, nset, ialset, istartset, iendset,
161  &num_ns, &num_ss, &num_es, &num_fs, NULL, exoid, (int) 0, nk);
162  printf ("Side sets to exo file not implemented.\n");
163  num_ss=0;
164 
165 #ifdef LONGLONG
166  // This handles LONGLONG transparently
167  remove(fneig);
168  exoid = ex_create (fneig, /*Filename*/
169  EX_ALL_INT64_API, /* create mode */
170  &CPU_word_size, /* CPU float word size in bytes */
171  &IO_word_size); /* I/O float word size in bytes */
172 #else
173  exoid = ex_create (fneig, /*Filename*/
174  EX_CLOBBER, /* create mode */
175  &CPU_word_size, /* CPU float word size in bytes */
176  &IO_word_size); /* I/O float word size in bytes */
177 #endif
178 
179  /* determining the number of elements */
180  if(*nmethod!=0){
181  nelout=0;
182  for(i=0;i<*ne0;i++){
183  if(ipkon[i]<=-1){
184  continue;
185  }else if(strcmp1(&lakon[8*i],"ESPRNGC")==0){
186  continue;
187  }else if(strcmp1(&lakon[8*i],"ESPRNGF")==0){
188  continue;
189  }else if(strcmp1(&lakon[8*i],"DCOUP3D")==0){
190  continue;
191  }else if(strcmp2(&lakon[8*i+6],"LC",2)==0){
192  // Count the number of layers
193  nlayer=0;
194  for(k=0;k<mi[2];k++){
195  if(ielmat[i*mi[2]+k]==0) break;
196  nlayer++;
197  }
198  // Allow an element for each layer
199  for(k=0;k<nlayer;k++){
200  nelout++;
201  }
202  }else{
203  nelout++;
204  }
205  }
206  }else{
207  nelout=*ne;
208  }
209  num_elem = nelout;
210 
211  /* initialize file with parameters */
212  printf("\nData writen to the .exo file\n");
213  num_nodes=nout;
214  printf("Number of nodes: %" ITGFORMAT "\n", num_nodes);
215  printf("Number of elements %" ITGFORMAT "\n", num_elem);
216  printf("Number of element blocks %" ITGFORMAT "\n", num_elem_blk);
217  printf("Number of node sets %" ITGFORMAT "\n", num_ns);
218  printf("Number of side sets %" ITGFORMAT "\n", num_ss);
219 
220  errr = ex_put_init (exoid, "CalculiX EXO File",
221  num_dim, num_nodes,
222  num_elem, num_elem_blk,
223  num_ns, num_ss);
224 
225  // Write values to database
226  errr = ex_put_coord (exoid, x, y, z);
227  if(errr)printf("*ERROR in exo: failed node positions");
228  errr = ex_put_node_num_map (exoid, node_map);
229  if(errr)printf("*ERROR in exo: failed node map");
230 
231  // Deallocate
232  free (node_map);
233  free (x);
234  free (y);
235  free (z);
236 
237  // Write coordinate names
238  char *coord_names[3];
239  coord_names[0] = "x";
240  coord_names[1] = "y";
241  coord_names[2] = "z";
242  errr = ex_put_coord_names (exoid, coord_names);
243  if(errr){printf("*ERROR in exo: failed coordinate names");}
244 
245  // Initialize enough memory to store the element numbers
246  ITG *elem_map;
247  elem_map = (ITG *) calloc(num_elem, sizeof(ITG));
248  char curblk[6]=" ";
249 
250  ITG *blkassign;
251  blkassign = (ITG *) calloc(num_elem, sizeof(ITG));
252 
253  l=0;
254  for(i=0;i<*ne0;i++){ // For each element. Composite elements are
255  // one increment in this loop and all layers
256  // have the same element number.
257  if(ipkon[i]<=-1){
258  continue;
259  }else if(strcmp1(&lakon[8*i],"F")==0){
260  continue;
261  }else if(strcmp1(&lakon[8*i],"ESPRNGC")==0){
262  continue;
263  }else if(strcmp1(&lakon[8*i],"ESPRNGF")==0){
264  continue;
265  }else if(strcmp1(&lakon[8*i],"DCOUP3D")==0){
266  continue;
267  }else{
268  indexe=ipkon[i];
269  }
270 
271  elem_map[l] = i+1;
272 
273  strcpy1(curblk,&lakon[8*i],5);
274  // strcpy1(curblk,&lakon[8*i],10);
275  // printf ("%s\n", curblk);
276  strcpy1(material,&matname[80*(ielmat[i*mi[2]]-1)],5);
277  // printf ("TODO store material identifier and name.\n");
278  if(strcmp1(&lakon[8*i+3],"2")==0){
279  /* 20-node brick element */
280  if(((strcmp1(&lakon[8*i+6]," ")==0)||
281  (strcmp1(&filab[4],"E")==0)||
282  (strcmp1(&lakon[8*i+6],"I")==0))&&
283  (strcmp2(&lakon[8*i+6],"LC",2)!=0)){
284  blkassign[l++]=1;
285  }else if(strcmp2(&lakon[8*i+6],"LC",2)==0){
286  /* composite material */
287  nlayer=0;
288  for(k=0;k<mi[2];k++){
289  if(ielmat[i*mi[2]+k]==0) break;
290  nlayer++;
291  }
292  for(k=0;k<nlayer;k++){
293  nemax++;
294  elem_map[l] = i+1;
295  blkassign[l++]=2;
296  }
297  }else if(strcmp1(&lakon[8*i+6],"B")==0){
298  /* 3-node beam element */
299  blkassign[l++]=3;
300  }else{
301  /* 8-node 2d element */
302  blkassign[l++]=4;
303  }
304  }else if(strcmp1(&lakon[8*i+3],"8")==0){
305  if((strcmp1(&lakon[8*i+6]," ")==0)||
306  (strcmp1(&filab[4],"E")==0)){
307  /* 8-node brick element */
308  blkassign[l++]=5;
309  }else if(strcmp1(&lakon[8*i+6],"B")==0){
310  /* 2-node 1d element */
311  if(strcmp1(&lakon[8*i+4],"R")==0){
312  blkassign[l++]=6;
313  }else if(strcmp1(&lakon[8*i+4],"I")==0){
314  blkassign[l++]=7;
315  }
316  }else{
317  /* 4-node 2d element */
318  /* not sure exactly what this does */
319  if(strcmp1(&lakon[8*i+6],"A")==0) iaxial=1;
320 
321  if(strcmp1(&lakon[8*i+4],"R")==0){
322  blkassign[l++]=8;
323  }else if(strcmp1(&lakon[8*i+4],"I")==0){
324  blkassign[l++]=9;
325  }
326  }
327  }else if((strcmp1(&lakon[8*i+3],"10")==0)||
328  (strcmp1(&lakon[8*i+3],"14")==0)){
329  /* 10-node tetrahedral element */
330  blkassign[l++]=10;
331  }else if(strcmp1(&lakon[8*i+3],"4")==0){
332  /* 4-node tetrahedral element */
333  blkassign[l++]=11;
334  }else if(strcmp1(&lakon[8*i+3],"15")==0){
335  if(((strcmp1(&lakon[8*i+6]," ")==0)||
336  (strcmp1(&filab[4],"E")==0))&&
337  (strcmp2(&lakon[8*i+6],"LC",2)!=0)){
338  /* 15-node wedge element */
339  blkassign[l++]=12;
340  }else{
341  /* 6-node 2d element */
342  /* not sure exactly what this does */
343  if(strcmp1(&lakon[8*i+6],"A")==0) iaxial=1;
344 
345  blkassign[l++]=13;
346  }
347  }else if(strcmp1(&lakon[8*i+3],"6")==0){
348  if((strcmp1(&lakon[8*i+6]," ")==0)||
349  (strcmp1(&filab[4],"E")==0)){
350  /* 6-node wedge element */
351  blkassign[l++]=14;
352  }else{
353  /* 3-node 2d element */ /* Shells and triangles */
354  /* not sure exactly what this does */
355  if(strcmp1(&lakon[8*i+6],"A")==0) iaxial=1;
356 
357  blkassign[l++]=15;
358  }
359  // }else if((strcmp1(&lakon[8*i],"D")==0)&&
360  // (strcmp1(&lakon[8*i],"DCOUP3D")!=0)){
361  }else if(strcmp1(&lakon[8*i],"D")==0){
362  if(kon[indexe]==0){
363  /* 2-node 1d element (network entry element) */
364  blkassign[l++]=16;
365  }else if(kon[indexe+2]==0){
366  /* 2-node 1d element (network exit element) */
367  blkassign[l++]=17;
368  }else{
369  /* 3-node 1d element (genuine network element) */
370  blkassign[l++]=18;
371  }
372  }else if((strcmp1(&lakon[8*i],"E")==0)&&
373  (strcmp1(&lakon[8*i+6],"A")==0)){
374  /* Not sure exactly what iaxial does yet */
375  if(strcmp1(&lakon[8*i+6],"A")==0) iaxial=1;
376  /* 2-node 1d element (spring element) */
377  blkassign[l++]=19;
378  }
379  }
380 
381 
382 
383  int num_nodes_per_elem[num_elem_blk];
384  char *blknames[num_elem_blk];
385  j=0;
386  num_nodes_per_elem[j]=1; blknames[j++]="PNT";
387  num_nodes_per_elem[j]=20; blknames[j++]="C3D20 C3D20R";
388  num_nodes_per_elem[j]=20; blknames[j++]="COMPOSITE LAYER C3D20";
389  num_nodes_per_elem[j]=3; blknames[j++]="Beam B32 B32R";
390  num_nodes_per_elem[j]=8; blknames[j++]="CPS8 CPE8 CAX8 S8 S8R";
391  num_nodes_per_elem[j]=8; blknames[j++]="C3D8 C3D8R";
392  num_nodes_per_elem[j]=2; blknames[j++]="TRUSS2";
393  num_nodes_per_elem[j]=2; blknames[j++]="TRUSS2";
394  num_nodes_per_elem[j]=4; blknames[j++]="CPS4R CPE4R S4 S4R";
395  num_nodes_per_elem[j]=4; blknames[j++]="CPS4I CPE4I";
396  num_nodes_per_elem[j]=10; blknames[j++]="C3D10";
397  num_nodes_per_elem[j]=4; blknames[j++]="C3D4";
398  num_nodes_per_elem[j]=15; blknames[j++]="C3D15";
399  num_nodes_per_elem[j]=6; blknames[j++]="CPS6 CPE6 S6";
400  num_nodes_per_elem[j]=6; blknames[j++]="C3D6";
401  num_nodes_per_elem[j]=3; blknames[j++]="CPS3 CPE3 S3";
402  num_nodes_per_elem[j]=2; blknames[j++]="2-node 1d network entry elem";
403  num_nodes_per_elem[j]=2; blknames[j++]="2-node 1d network exit elem";
404  num_nodes_per_elem[j]=3; blknames[j++]="2-node 1d genuine network elem";
405  num_nodes_per_elem[j]=2; blknames[j++]="2-node 1d spring elem";
406 
407  errr = ex_put_names (exoid, EX_ELEM_BLOCK, blknames);
408  if(errr){printf("*ERROR in exo: cannot write block names");}
409 
410 
411  /* write element connectivity */
412  ITG *connect;
413  ITG num_elem_in_blk;
414  ITG blksize[num_elem_blk];
415 
416  for(l=0;l<num_elem_blk;l++){
417  // First determine the size of the block
418  j=0;
419  m=0;
420  for(i=0;i<*ne0;i++){
421  if(ipkon[i]<0) continue;
422  if(blkassign[m]==l){
423  if(blkassign[m]==2){//composite
424  for(k=0;k<mi[2];k++){
425  if(ielmat[i*mi[2]+k]==0) break;
426  j++;
427  }
428  }else{
429  j++;
430  }
431  }
432  m++;
433  }
434 
435  blksize[l]=j;
436  num_elem_in_blk=blksize[l];
437 
438  connect = (ITG *) calloc (num_elem_in_blk*num_nodes_per_elem[l], sizeof(ITG));
439  // printf ("Size of connect %" ITGFORMAT "\n", num_elem_in_blk*num_nodes_per_elem[l]*sizeof(ITG));
440  k=0; o=0;
441  // Now connectivity
442  for(i=0;i<*ne0;i++){
443  if(ipkon[i]<0) continue;
444  indexe=ipkon[i];
445  if (blkassign[o]==l){
446  // printf ("block assignment %" ITGFORMAT "\n", blkassign[o]);
447  if(blkassign[o]==1){ // C3D20
448  for(m=0;m<12;m++){connect[k++] = node_map_inv[kon[indexe+m]-1];}
449  for(m=16;m<20;m++){connect[k++] = node_map_inv[kon[indexe+m]-1];}
450  for(m=12;m<16;m++){connect[k++] = node_map_inv[kon[indexe+m]-1];}
451  }else if(blkassign[o]==12){ // C3D15
452  for(m=0;m<9;m++){connect[k++] = node_map_inv[kon[indexe+m]-1];}
453  for(m=12;m<15;m++){connect[k++] = node_map_inv[kon[indexe+m]-1];}
454  for(m=9;m<12;m++){connect[k++] = node_map_inv[kon[indexe+m]-1];}
455  }else if (blkassign[o]==2){ // Composite
456  nlayer=0;
457  for(l=0;l<mi[2];l++){
458  if(ielmat[i*mi[2]+l]==0) break;
459  nlayer++;
460  }
461  for(n=0;n<nlayer;n++){
462  for(m=0;m<12;m++){connect[k++] = node_map_inv[kon[indexe+28+20*n+m]-1];}
463  for(m=16;m<20;m++){connect[k++] = node_map_inv[kon[indexe+28+20*n+m]-1];}
464  for(m=12;m<16;m++){connect[k++] = node_map_inv[kon[indexe+28+20*n+m]-1];}
465  }
466  }else if(blkassign[o]==4){ // 8 Node 2D elements CAX8 S8 S8R etc
467  for (j = 0; j <num_nodes_per_elem[l]; j++){
468  connect[k++] = node_map_inv[kon[indexe+20+j]-1];
469  }
470  }else if(blkassign[o]== 5 || // C3D8 or C3D8R
471  blkassign[o]==10 || // C3D10
472  blkassign[o]==11 || // C3D4
473  blkassign[o]==14){ // C3D6
474  for (j = 0; j <num_nodes_per_elem[l]; j++){
475  connect[k++] = node_map_inv[kon[indexe+j]-1];
476  }
477  }else if(blkassign[o]==13){ // 6-node 2D element (S6)
478  for (j = 0; j <num_nodes_per_elem[l]; j++){
479  connect[k++] = node_map_inv[kon[indexe+15+j]-1];
480  }
481  }else if(blkassign[o]==15){ // 2D triangle or 3-node shell
482  for (j = 0; j <num_nodes_per_elem[l]; j++){
483  connect[k++] = node_map_inv[kon[indexe+6+j]-1];
484  }
485  }else { // 4 node shell element?
486  for (j = 0; j <num_nodes_per_elem[l]; j++){
487  // RETAIN FOR A TIME TO SEE IF ANYTHING BREAKS.
488  // Introduced new element classifications above in 2.8
489  connect[k++] = node_map_inv[kon[indexe+8+j]-1];
490  }
491  }
492  }
493  o++;
494  }
495 
496  int num_attr=0;
497  switch (l)
498  {
499  case 0:
500  errr = ex_put_elem_block (exoid, l, "SPHERE", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
501  break;
502  case 1:
503  errr = ex_put_elem_block (exoid, l, "HEX", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
504  break;
505  case 2:
506  errr = ex_put_elem_block (exoid, l, "HEX", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
507  break;
508  case 3:
509  errr = ex_put_elem_block (exoid, l, "TRUSS", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
510  break;
511  case 4:
512  errr = ex_put_elem_block (exoid, l, "QUAD", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
513  break;
514  case 5:
515  errr = ex_put_elem_block (exoid, l, "HEX", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
516  break;
517  case 6:
518  errr = ex_put_elem_block (exoid, l, "TRUSS", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
519  break;
520  case 7:
521  errr = ex_put_elem_block (exoid, l, "TRUSS", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
522  break;
523  case 8:
524  errr = ex_put_elem_block (exoid, l, "SHELL", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
525  break;
526  case 9:
527  errr = ex_put_elem_block (exoid, l, "SHELL", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
528  break;
529  case 10:
530  errr = ex_put_elem_block (exoid, l, "TETRA", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
531  break;
532  case 11:
533  errr = ex_put_elem_block (exoid, l, "TETRA", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
534  break;
535  case 12:
536  errr = ex_put_elem_block (exoid, l, "WEDGE", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
537  break;
538  case 13:
539  errr = ex_put_elem_block (exoid, l, "HEX", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
540  break;
541  case 14:
542  errr = ex_put_elem_block (exoid, l, "WEDGE", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
543  break;
544  case 15:
545  // KEEP FOR AWHILE CHECKING BREAKAGE
546  // errr = ex_put_elem_block (exoid, l, "WEDGE", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
547  errr = ex_put_elem_block (exoid, l, "TRIANGLE", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
548  break;
549  default:
550  // case 16:
551  // case 17:
552  // case 18:
553  // case 19:
554  errr = ex_put_elem_block (exoid, l, "TRUSS", num_elem_in_blk, num_nodes_per_elem[l], num_attr);
555  break;
556  };
557 
558 
559 
560  if (num_elem_in_blk>0){
561  errr = ex_put_elem_conn (exoid, l, connect);
562  if (errr)
563  printf ("ERROR in ex_put_elem_conn %i\n", errr);
564  }
565  free (connect);
566  }
567 
568  // Write the element map into the file
569  errr = ex_put_elem_num_map (exoid, elem_map);
570  if (errr)
571  printf ("ERROR in ex_put_elem_num_map %i\n", errr);
572 
573  // Write the node sets into the file
574  exosetfind(set, nset, ialset, istartset, iendset,
575  &num_ns, &num_ss, &num_es, &num_fs, node_map_inv, exoid, (int) 1, nk);
576 
577  // Free up memory which is gathering dust
578  free (elem_map);
579  free (blkassign);
580 
581  // Close files
582  ex_update (exoid);
583  ex_close (exoid);
584 
585  if(*nmethod==0){return;}
586 
587  /* End of if(*kode==1) */
588  }
589 
590 
591 
592 
593  /* Start the data storage section */
594  float version;
595  exoid = ex_open (fneig, /*Filename*/
596  EX_WRITE, /* create mode */
597  &CPU_word_size, /* CPU float word size in bytes */
598  &IO_word_size, /* I/O float word size in bytes */
599  &version);
600 
601  // Define an output variable for general use
602  float *nodal_var_vals;
603 
604  int num_time_steps;
605  float fdum;
606  char cdum = 0;
607 
608  float timet;
609  errr = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, &cdum);
610  errr = ex_get_time (exoid, num_time_steps, &timet);
611  if (num_time_steps>0){
612  printf ("\t%i Time periods in exo file, most recent at time=%f\n", num_time_steps, timet);
613  } else {
614  printf ("\t0 Time periods in exo file\n");
615  }
616  timet = (float) *time;
617  ++num_time_steps;
618  printf ("\tWriting new time period %" ITGFORMAT " at time=%f\n", num_time_steps, *time);
619  errr = ex_put_time (exoid, num_time_steps, &timet);
620  if (errr) printf ("Error storing time into exo file.\n");
621 
622  // Statically allocate an array of pointers. Can't figure out how to do this dynamically.
623  // 100 should be enough to store the variable names.
624  char *var_names[100];
625 
626  int countvars=0;
627  int countbool=3;
628 
629  while(countbool>0){
630  // First time count
631  // Second time assign names
632  // Last time save data
633 
634  /* for cyclic symmetry frequency calculations only results for
635  even numbers (= odd modes, numbering starts at 0) are stored */
636  if((*nmethod==2)&&(((*mode/2)*2!=*mode)&&(*noddiam>=0))){ex_close(exoid);return;}
637 
638  /* storing the displacements in the nodes */
639  if((*nmethod!=5)||(*mode==-1)){
640  if((strcmp1(filab,"U ")==0)&&(*ithermal!=2)){
641  if (countbool==3){
642  countvars+=3;
643  }else if(countbool==2){
644  var_names[countvars++]="Ux";
645  var_names[countvars++]="Uy";
646  var_names[countvars++]="Uz";
647  }else{
648  iselect=1;
649 
650  frdset(filab,set,&iset,istartset,iendset,ialset,
651  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
652  ngraph);
653 
654  exovector(v,&iset,ntrans,filab,&nkcoords,inum,m1,inotr,
655  trab,co,istartset,iendset,ialset,mi,ngraph,f1,output,m3,
656  exoid, num_time_steps,countvars,nout);
657  countvars+=3;
658  }
659  }
660  }
661 
662  /* storing the imaginary part of displacements in the nodes
663  for the odd modes of cyclic symmetry calculations */
664  if(*noddiam>=0){
665  if(strcmp1(filab,"U ")==0){
666  if (countbool==3){
667  countvars+=3;
668  }else if(countbool==2){
669  var_names[countvars++]="U-imag-x";
670  var_names[countvars++]="U-imag-y";
671  var_names[countvars++]="U-imag-z";
672  }else{
673  exovector(&v[*nk*mt],&iset,ntrans,filab,&nkcoords,inum,m1,inotr,
674  trab,co,istartset,iendset,ialset,mi,ngraph,f1,output,m3,
675  exoid,num_time_steps,countvars,nout);
676 
677  countvars+=3;
678  }
679  }
680  }
681 
682  /* storing the imaginary part of displacements in the nodes
683  for steady state calculations */
684  if((*nmethod==5)&&(*mode==0)){
685  if((strcmp1(filab,"U ")==0)&&(*ithermal!=2)){
686  if (countbool==3){
687  countvars+=3;
688  }else if(countbool==2){
689  var_names[countvars++]="U-imag-x";
690  var_names[countvars++]="U-imag-y";
691  var_names[countvars++]="U-imag-z";
692  }else{
693  iselect=1;
694  exovector(v,&iset,ntrans,filab,&nkcoords,inum,m1,inotr,
695  trab,co,istartset,iendset,ialset,mi,ngraph,f1,output,m3,
696  exoid,num_time_steps,countvars,nout);
697  countvars+=3;
698  }
699  }
700  }
701 
702  /* storing the velocities in the nodes */
703  if((strcmp1(&filab[1740],"V ")==0)&&(*ithermal!=2)){
704  if (countbool==3){
705  countvars+=3;
706  }else if(countbool==2){
707  var_names[countvars++]="Vx";
708  var_names[countvars++]="Vy";
709  var_names[countvars++]="Vz";
710  }else{
711  iselect=1;
712 
713  frdset(&filab[1740],set,&iset,istartset,iendset,ialset,
714  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
715  ngraph);
716 
717  exovector(veold,&iset,ntrans,&filab[1740],&nkcoords,inum,m1,inotr,
718  trab,co,istartset,iendset,ialset,mi,ngraph,f1,output,m3,
719  exoid,num_time_steps,countvars,nout);
720 
721  countvars+=3;
722  }
723  }
724 
725  /* storing the temperatures in the nodes */
726  if(strcmp1(&filab[87],"NT ")==0){
727  if (countbool==3){
728  countvars+=1;
729  }else if(countbool==2){
730  var_names[countvars++]="NT";
731  }else{
732  iselect=0;
733 
734  frdset(&filab[87],set,&iset,istartset,iendset,ialset,
735  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
736  ngraph);
737 
738  if(*ithermal<=1){
739  exoselect(t1,t1,&iset,&nkcoords,inum,istartset,iendset,
740  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
741  nfieldscalar,&iselect,exoid,num_time_steps,countvars,nout);
742  }else{
743  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
744  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
745  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
746  }
747  countvars+=1;
748  }
749  }
750 
751  /* storing the electrical potential in the nodes */
752  if((strcmp1(&filab[3654],"POT ")==0)&&(*ithermal==2)){
753  if (countbool==3){
754  countvars+=1;
755  }else if(countbool==2){
756  var_names[countvars++]="POT";
757  }else{
758  iselect=0;
759 
760  frdset(&filab[3654],set,&iset,istartset,iendset,ialset,
761  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
762  ngraph);
763 
764  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
765  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
766  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
767  printf ("Warning: export POT to exo not tested.\n");
768  countvars+=1;
769  }
770  }
771 
772  /* storing the stresses in the nodes */
773  if((*nmethod!=5)||(*mode==-1)){
774  if((strcmp1(&filab[174],"S ")==0)&&(*ithermal!=2)){
775  if (countbool==3){
776  countvars+=6;
777  }else if(countbool==2){
778  // Note reordered relative to frd file
779  // Order must be xx yy zz xy xz yz
780  var_names[countvars++]="Sxx";
781  var_names[countvars++]="Syy";
782  var_names[countvars++]="Szz";
783  var_names[countvars++]="Sxy";
784  var_names[countvars++]="Sxz";
785  var_names[countvars++]="Syz";
786  }else{
787  iselect=1;
788 
789  frdset(&filab[174],set,&iset,istartset,iendset,ialset,
790  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
791  ngraph);
792 
793  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
794  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
795  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
796  countvars+=6;
797  }
798  }
799  }
800 
801  /* storing the imaginary part of the stresses in the nodes
802  for the odd modes of cyclic symmetry calculations */
803  if(*noddiam>=0){
804  if((strcmp1(&filab[174],"S ")==0)&&(*ithermal!=2)){
805  if (countbool==3){
806  countvars+=6;
807  }else if(countbool==2){
808  // Note reordered relative to frd file
809  // Order must be xx yy zz xy xz yz
810  var_names[countvars++]="S-imagxx";
811  var_names[countvars++]="S-imagyy";
812  var_names[countvars++]="S-imagzz";
813  var_names[countvars++]="S-imagxy";
814  var_names[countvars++]="S-imagzx";
815  var_names[countvars++]="S-imagyz";
816  }else{
817  exoselect(&stn[6**nk],stn,&iset,&nkcoords,inum,istartset,iendset,
818  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
819  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
820  countvars+=6;
821  }
822  }
823  }
824 
825  /* storing the imaginary part of the stresses in the nodes
826  for steady state calculations */
827  if((*nmethod==5)&&(*mode==0)){
828  if((strcmp1(&filab[174],"S ")==0)&&(*ithermal!=2)){
829  if (countbool==3){
830  countvars+=6;
831  }else if(countbool==2){
832  // Note reordered relative to frd file
833  // Order must be xx yy zz xy xz yz
834  var_names[countvars++]="S-imagxx";
835  var_names[countvars++]="S-imagyy";
836  var_names[countvars++]="S-imagzz";
837  var_names[countvars++]="S-imagxy";
838  var_names[countvars++]="S-imagzx";
839  var_names[countvars++]="S-imagyz";
840  }else{
841  iselect=1;
842 
843  frdset(&filab[174],set,&iset,istartset,iendset,ialset,
844  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
845  ngraph);
846 
847  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
848  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
849  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
850 
851  countvars+=6;
852  }
853  }
854  }
855 
856  /* storing the electromagnetic field E in the nodes */
857  if((strcmp1(&filab[3741],"EMFE")==0)&&(*ithermal!=2)){
858  if (countbool==3){
859  countvars+=3;
860  }else if(countbool==2){
861  var_names[countvars++]="EMF-Ex";
862  var_names[countvars++]="EMF-Ey";
863  var_names[countvars++]="EMF-Ez";
864  }else{
865  iselect=1;
866 
867  frdset(&filab[3741],set,&iset,istartset,iendset,ialset,
868  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
869  ngraph);
870 
871  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
872  ialset,ngraph,&ncompvector,ifieldvector,icompvector,
873  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
874  printf ("Warning: export EMF-E to exo not tested.\n");
875  countvars+=3;
876  }
877  }
878 
879  /* storing the electromagnetic field B in the nodes */
880  if((strcmp1(&filab[3828],"EMFB")==0)&&(*ithermal!=2)){
881  if (countbool==3){
882  countvars+=3;
883  }else if(countbool==2){
884  var_names[countvars++]="EMF-Bx";
885  var_names[countvars++]="EMF-By";
886  var_names[countvars++]="EMF-Bz";
887  }else{
888  iselect=1;
889 
890  frdset(&filab[3828],set,&iset,istartset,iendset,ialset,
891  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
892  ngraph);
893 
894  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
895  ialset,ngraph,&ncompvector,ifieldvector,icompvectorlast,
896  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
897  printf ("Warning: export EMF-B to exo not tested.\n");
898  countvars+=3;
899  }
900  }
901 
902  /* storing the total strains in the nodes */
903  if((*nmethod!=5)||(*mode==-1)){
904  if((strcmp1(&filab[261],"E ")==0)&&(*ithermal!=2)){
905  if (countbool==3){
906  countvars+=6;
907  }else if(countbool==2){
908  // Note reordered relative to frd file
909  // Order must be xx yy zz xy xz yz
910  var_names[countvars++]="Exx";
911  var_names[countvars++]="Eyy";
912  var_names[countvars++]="Ezz";
913  var_names[countvars++]="Exy";
914  var_names[countvars++]="Exz";
915  var_names[countvars++]="Eyz";
916  }else{
917  iselect=1;
918 
919 
920  frdset(&filab[261],set,&iset,istartset,iendset,ialset,
921  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
922  ngraph);
923 
924  exoselect(een,een,&iset,&nkcoords,inum,istartset,iendset,
925  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
926  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
927 
928  countvars+=6;
929  }
930  }
931  }
932 
933  /* storing the imaginary part of the total strains in the nodes
934  for the odd modes of cyclic symmetry calculations */
935  if(*noddiam>=0){
936  if(strcmp1(&filab[261],"E ")==0){
937  if (countbool==3){
938  countvars+=6;
939  }else if(countbool==2){
940  // Note reordered relative to frd file
941  // Order must be xx yy zz xy xz yz
942  var_names[countvars++]="E-imagxx";
943  var_names[countvars++]="E-imagyy";
944  var_names[countvars++]="E-imagzz";
945  var_names[countvars++]="E-imagxy";
946  var_names[countvars++]="E-imagxz";
947  var_names[countvars++]="E-imagyz";
948  }else{
949  exoselect(&een[6**nk],een,&iset,&nkcoords,inum,istartset,iendset,
950  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
951  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
952 
953  countvars+=6;
954  }
955  }
956  }
957 
958  /* storing the imaginary part of the total strains in the nodes
959  for steady state calculations */
960  if((*nmethod==5)&&(*mode==0)){
961  if((strcmp1(&filab[261],"E ")==0)&&(*ithermal!=2)){
962  if (countbool==3){
963  countvars+=6;
964  }else if(countbool==2){
965  // Note reordered relative to frd file
966  // Order must be xx yy zz xy xz yz
967  var_names[countvars++]="E-imagxx";
968  var_names[countvars++]="E-imagyy";
969  var_names[countvars++]="E-imagzz";
970  var_names[countvars++]="E-imagxy";
971  var_names[countvars++]="E-imagxz";
972  var_names[countvars++]="E-imagyz";
973  }else{
974  iselect=1;
975 
976  frdset(&filab[261],set,&iset,istartset,iendset,ialset,
977  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
978  ngraph);
979 
980  exoselect(een,een,&iset,&nkcoords,inum,istartset,iendset,
981  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
982  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
983  printf ("Warning: export E-imag to exo not tested.\n");
984  countvars+=6;
985  }
986  }
987  }
988 
989  /* storing the mechanical strains in the nodes */
990  if((*nmethod!=5)||(*mode==-1)){
991  if((strcmp1(&filab[2697],"ME ")==0)&&(*ithermal!=2)){
992  if (countbool==3){
993  countvars+=6;
994  }else if(countbool==2){
995  // Note reordered relative to frd file
996  // Order must be xx yy zz xy xz yz
997  var_names[countvars++]="MExx";
998  var_names[countvars++]="MEyy";
999  var_names[countvars++]="MEzz";
1000  var_names[countvars++]="MExy";
1001  var_names[countvars++]="MExz";
1002  var_names[countvars++]="MEyz";
1003  }else{
1004  iselect=1;
1005  frdset(&filab[2697],set,&iset,istartset,iendset,ialset,
1006  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1007  ngraph);
1008  exoselect(emn,emn,&iset,&nkcoords,inum,istartset,iendset,
1009  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
1010  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1011  countvars+=6;
1012  }
1013  }
1014  }
1015 
1016  /* storing the imaginary part of the mechanical strains in the nodes
1017  for the odd modes of cyclic symmetry calculations */
1018  if((*noddiam>=0)||((*nmethod==5)&&(*mode==0))){
1019  if((strcmp1(&filab[2697],"ME ")==0)&&(*ithermal!=2)){
1020  if (countbool==3){
1021  countvars+=6;
1022  }else if(countbool==2){
1023  // Note reordered relative to frd file
1024  // Order must be xx yy zz xy xz yz
1025  var_names[countvars++]="ME-imagxx";
1026  var_names[countvars++]="ME-imagyy";
1027  var_names[countvars++]="ME-imagzz";
1028  var_names[countvars++]="ME-imagxy";
1029  var_names[countvars++]="ME-imagxz";
1030  var_names[countvars++]="ME-imagyz";
1031  }else{
1032  exoselect(&emn[6**nk],een,&iset,&nkcoords,inum,istartset,iendset,
1033  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
1034  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1035  countvars+=6;
1036  }
1037  }
1038  }
1039 
1040  /* storing the forces in the nodes */
1041  if((*nmethod!=5)||(*mode==-1)){
1042  if((strcmp1(&filab[348],"RF ")==0)&&(*ithermal!=2)){
1043  if (countbool==3){
1044  countvars+=3;
1045  }else if(countbool==2){
1046  var_names[countvars++]="RFx";
1047  var_names[countvars++]="RFy";
1048  var_names[countvars++]="RFz";
1049  }else{
1050  iselect=1;
1051  frdset(&filab[348],set,&iset,istartset,iendset,ialset,
1052  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1053  ngraph);
1054  if((iaxial==1)&&(strcmp1(&filab[352],"I")==0)){for(i=0;i<*nk;i++){fn[1+i*mt]*=180.;fn[2+i*mt]*=180.;fn[3+i*mt]*=180.;}}
1055  exovector(fn,&iset,ntrans,&filab[348],&nkcoords,inum,m1,inotr,
1056  trab,co,istartset,iendset,ialset,mi,ngraph,f1,output,m3,
1057  exoid,num_time_steps,countvars,nout);
1058  if((iaxial==1)&&(strcmp1(&filab[352],"I")==0)){for(i=0;i<*nk;i++){fn[1+i*mt]/=180.;fn[2+i*mt]/=180.;fn[3+i*mt]/=180.;}}
1059  countvars+=3;
1060  }
1061  }
1062  }
1063 
1064  /* storing the imaginary part of the forces in the nodes
1065  for the odd modes of cyclic symmetry calculations */
1066  if((*noddiam>=0)||((*nmethod==5)&&(*mode==0))){
1067  if((strcmp1(&filab[348],"RF ")==0)&&(*ithermal!=2)){
1068  if (countbool==3){
1069  countvars+=3;
1070  }else if(countbool==2){
1071  var_names[countvars++]="RF-imagx";
1072  var_names[countvars++]="RF-imagy";
1073  var_names[countvars++]="RF-imagz";
1074  }else{
1075  exovector(&fn[*nk*mt],&iset,ntrans,filab,&nkcoords,inum,m1,inotr,
1076  trab,co,istartset,iendset,ialset,mi,ngraph,f1,output,m3,
1077  exoid,num_time_steps,countvars,nout);
1078  countvars+=3;
1079  }
1080  }
1081  }
1082 
1083  /* storing the equivalent plastic strains in the nodes */
1084  if((strcmp1(&filab[435],"PEEQ")==0)&&(*ithermal!=2)){
1085  if (countbool==3){
1086  countvars+=1;
1087  }else if(countbool==2){
1088  var_names[countvars++]="PEEQ";
1089  }else{
1090  iselect=1;
1091  frdset(&filab[435],set,&iset,istartset,iendset,ialset,
1092  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1093  ngraph);
1094  exoselect(epn,epn,&iset,&nkcoords,inum,istartset,iendset,
1095  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
1096  nfieldscalar,&iselect,exoid,num_time_steps,countvars,nout);
1097  printf ("Warning: export PEEQ to exo not tested.\n");
1098  countvars+=1;
1099  }
1100  }
1101 
1102 
1103  /* storing the energy in the nodes */
1104  if((strcmp1(&filab[522],"ENER")==0)&&(*ithermal!=2)){
1105  if (countbool==3){
1106  countvars+=1;
1107  }else if(countbool==2){
1108  var_names[countvars++]="ENER";
1109  }else{
1110  iselect=1;
1111  frdset(&filab[522],set,&iset,istartset,iendset,ialset,
1112  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1113  ngraph);
1114  exoselect(enern,enern,&iset,&nkcoords,inum,istartset,iendset,
1115  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
1116  nfieldscalar,&iselect,exoid,num_time_steps,countvars,nout);
1117  printf ("Warning: export ENER to exo not tested.\n");
1118  countvars+=1;
1119  }
1120  }
1121 
1122  /* storing the contact displacements and stresses at the slave nodes */
1123  /* node-to-face penalty */
1124  if((strcmp1(&filab[2175],"CONT")==0)&&(*mortar!=1)&&(*ithermal!=2)&&(*nmethod!=2)){
1125  if (countbool==3){
1126  countvars+=6;
1127  }else if(countbool==2){
1128  var_names[countvars++]="COPEN";
1129  var_names[countvars++]="CSLIP1";
1130  var_names[countvars++]="CSLIP2";
1131  var_names[countvars++]="CPRESS";
1132  var_names[countvars++]="CSHEAR1";
1133  var_names[countvars++]="CSHEAR2";
1134  }else{
1135 
1136  nodal_var_vals = (float *) calloc (nout, sizeof(float));
1137 
1138  for(i=*ne-1;i>=0;i--){
1139  if((strcmp1(&lakon[8*i+1],"S")!=0)||(strcmp1(&lakon[8*i+6],"C")!=0))
1140  break;
1141  }
1142  noutloc=*ne-i-1;
1143 
1144  for(j=0;j<6;j++){
1145  for(i=*ne-1;i>=0;i--){
1146  if((strcmp1(&lakon[8*i+1],"S")!=0)||(strcmp1(&lakon[8*i+6],"C")!=0))
1147  break;
1148  strcpy1(text,&lakon[8*i+7],1);
1149  nope=atoi(text)+1;
1150  nodes=node_map_inv[kon[ipkon[i]+nope-1]-1]-1;
1151  nodal_var_vals[nodes]=stx[6*mi[0]*i+j];
1152  }
1153 
1154  errr = ex_put_nodal_var (exoid, num_time_steps, 1+countvars++, nout, nodal_var_vals);
1155  if (errr) printf ("ERROR storing contact data into exo file.\n");
1156  }
1157 
1158  free(nodal_var_vals);
1159  printf ("Warning: export CONT to exo not tested.\n");
1160  countvars+=6;
1161  }
1162  }
1163 
1164  /* face-to-face penalty */
1165  if((*nmethod!=5)||(*mode==-1)){
1166  if((strcmp1(&filab[2175],"CONT")==0)&&(*mortar==1)&&(*ithermal!=2)){
1167  if (countbool==3){
1168  countvars+=6;
1169  }else if(countbool==2){
1170  var_names[countvars++]="COPEN";
1171  var_names[countvars++]="CSLIP1";
1172  var_names[countvars++]="CSLIP2";
1173  var_names[countvars++]="CPRESS";
1174  var_names[countvars++]="CSHEAR1";
1175  var_names[countvars++]="CSHEAR2";
1176  }else{
1177  iselect=1;
1178 
1179  frdset(&filab[2175],set,&iset,istartset,iendset,ialset,
1180  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1181  ngraph);
1182 
1183  exoselect(cdn,cdn,&iset,&nkcoords,inum,istartset,iendset,
1184  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
1185  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1186  printf ("Warning: export CONT to exo not tested.\n");
1187  countvars+=6;
1188  }
1189  }
1190  }
1191 
1192  /* storing imaginary part of the differential contact displacements
1193  and the contact stresses for the odd modes of cyclic symmetry
1194  calculations */
1195  if((*noddiam>=0)||((*nmethod==5)&&(*mode==0))){
1196  if((strcmp1(&filab[2175],"CONT")==0)&&(*mortar==1)&&(*ithermal!=2)){
1197  if (countbool==3){
1198  countvars+=6;
1199  }else if(countbool==2){
1200  var_names[countvars++]="COPEN-Imag";
1201  var_names[countvars++]="CSLIP1-Imag";
1202  var_names[countvars++]="CSLIP2-Imag";
1203  var_names[countvars++]="CPRESS-Imag";
1204  var_names[countvars++]="CSHEAR1-Imag";
1205  var_names[countvars++]="CSHEAR2-Imag";
1206  }else{
1207  iselect=1;
1208  exoselect(&cdn[6**nk],cdn,&iset,&nkcoords,inum,istartset,iendset,
1209  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
1210  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1211  countvars+=6;
1212  }
1213  }
1214  }
1215 
1216  /* storing the contact energy at the slave nodes */
1217  if((strcmp1(&filab[2262],"CELS")==0)&&(*ithermal!=2)){
1218  if (countbool==3){
1219  countvars+=1;
1220  }else if(countbool==2){
1221  var_names[countvars++]="CELS";
1222  }else{
1223  for(i=*ne-1;i>=0;i--){
1224  if((strcmp1(&lakon[8*i+1],"S")!=0)||(strcmp1(&lakon[8*i+6],"C")!=0))
1225  break;
1226  }
1227  noutloc=*ne-i-1;
1228 
1229  nodal_var_vals = (float *) calloc (nkcoords, sizeof(float));
1230  for(i=*ne-1;i>=0;i--){
1231  if((strcmp1(&lakon[8*i+1],"S")!=0)||(strcmp1(&lakon[8*i+6],"C")!=0))
1232  break;
1233  nope=atoi(&lakon[8*i+7])+1;
1234  nodes=node_map_inv[kon[ipkon[i]+nope-1]-1]-1;
1235  nodal_var_vals[nodes]=ener[i*mi[0]];
1236  }
1237 
1238  countvars+=1;
1239  int errr = ex_put_nodal_var (exoid, num_time_steps, countvars, nout, nodal_var_vals);
1240  if (errr) printf ("ERROR storing CELS data into exo file.\n");
1241 
1242  free(nodal_var_vals);
1243  }
1244  }
1245 
1246  /* storing the internal state variables in the nodes */
1247  if(strcmp1(&filab[609],"SDV ")==0){
1248  if (countbool==3){
1249  countvars+=*nstate_;
1250  }else if(countbool==2){
1251  for(j=1;j<=*nstate_;j++){
1252  sprintf(var_names[countvars++],"SDV%" ITGFORMAT,j);
1253  }
1254  }else{
1255  iselect=1;
1256 
1257  frdset(&filab[609],set,&iset,istartset,iendset,ialset,
1258  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1259  ngraph);
1260 
1261  for(i=0;i<*nstate_;i++){
1262  ifieldstate[i]=1;icompstate[i]=i;
1263  }
1264  nfield[0]=*nstate_;
1265 
1266  exoselect(xstaten,xstaten,&iset,&nkcoords,inum,istartset,iendset,
1267  ialset,ngraph,nstate_,ifieldstate,icompstate,
1268  nfield,&iselect,exoid,num_time_steps,countvars,nout);
1269  countvars+=*nstate_;
1270  }
1271  }
1272 
1273  /* storing the heat flux in the nodes
1274  the heat flux has been extrapolated from the integration points
1275  in subroutine extropolate.f, taking into account whether the
1276  results are requested in the global system or in a local system.
1277  Therefore, subroutine exovector cannot be used, since it assumes
1278  the values are stored in the global system */
1279  if((strcmp1(&filab[696],"HFL ")==0)&&(*ithermal>1)){
1280  if (countbool==3){
1281  countvars+=3;
1282  }else if(countbool==2){
1283  var_names[countvars++]="HFLx";
1284  var_names[countvars++]="HFLy";
1285  var_names[countvars++]="HFLz";
1286  }else{
1287  iselect=1;
1288 
1289  frdset(&filab[696],set,&iset,istartset,iendset,ialset,
1290  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1291  ngraph);
1292 
1293  exoselect(qfn,qfn,&iset,&nkcoords,inum,istartset,iendset,
1294  ialset,ngraph,&ncompvector,ifieldvector,icompvector,
1295  nfieldvector1,&iselect,exoid,num_time_steps,countvars,nout);
1296  countvars+=3;
1297  }
1298  }
1299 
1300  /* storing the electrical current in the nodes
1301  (cf. heat flux HFL above) */
1302 
1303  if((strcmp1(&filab[3567],"ECD ")==0)&&(*ithermal==2)){
1304  if (countbool==3){
1305  countvars+=3;
1306  }else if(countbool==2){
1307  var_names[countvars++]="ECDx";
1308  var_names[countvars++]="ECDy";
1309  var_names[countvars++]="ECDz";
1310  }else{
1311  iselect=1;
1312 
1313  frdset(&filab[3567],set,&iset,istartset,iendset,ialset,
1314  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1315  ngraph);
1316 
1317  exoselect(qfn,qfn,&iset,&nkcoords,inum,istartset,iendset,
1318  ialset,ngraph,&ncompvector,ifieldvector,icompvector,
1319  nfieldvector1,&iselect,exoid,num_time_steps,countvars,nout);
1320  printf ("Warning: export ECD to exo not tested.\n");
1321  countvars+=3;
1322  }
1323  }
1324 
1325  /* storing the heat generation in the nodes */
1326  if((strcmp1(&filab[783],"RFL ")==0)&&(*ithermal>1)){
1327  if (countbool==3){
1328  countvars+=1;
1329  }else if(countbool==2){
1330  var_names[countvars++]="RFL";
1331  }else{
1332  iselect=1;
1333 
1334  frdset(&filab[783],set,&iset,istartset,iendset,ialset,
1335  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1336  ngraph);
1337  exoselect(fn,fn,&iset,&nkcoords,inum,istartset,iendset,
1338  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
1339  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1340  countvars+=1;
1341  }
1342  }
1343 
1344  /* storing the Zienkiewicz-Zhu improved stresses in the nodes */
1345  if((*nmethod!=5)||(*mode==-1)){
1346  if((strcmp1(&filab[1044],"ZZS")==0)&&(*ithermal!=2)){
1347  if (countbool==3){
1348  countvars+=6;
1349  }else if(countbool==2){
1350  // Note reordered relative to frd file
1351  // Order must be xx yy zz xy xz yz
1352  var_names[countvars++]="ZZSxx";
1353  var_names[countvars++]="ZZSyy";
1354  var_names[countvars++]="ZZSzz";
1355  var_names[countvars++]="ZZSxy";
1356  var_names[countvars++]="ZZSxz";
1357  var_names[countvars++]="ZZSyz";
1358  }else{
1359  FORTRAN(zienzhu,(co,nk,kon,ipkon,lakon,ne0,stn,ipneigh,neigh,
1360  stx,&mi[0]));
1361 
1362  iselect=1;
1363 
1364  frdset(&filab[1044],set,&iset,istartset,iendset,ialset,
1365  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1366  ngraph);
1367 
1368  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
1369  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
1370  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1371  printf ("Warning: export of ZZSTR to exo not tested.\n");
1372  countvars+=6;
1373  }
1374  }
1375  }
1376 
1377  /* storing the imaginary part of the Zienkiewicz-Zhu
1378  improved stresses in the nodes
1379  for the odd modes of cyclic symmetry calculations */
1380 
1381  if((*noddiam>=0)||((*nmethod==5)&&(*mode==0))){
1382  if((strcmp1(&filab[1044],"ZZS")==0)&&(*ithermal!=2)){
1383  if (countbool==3){
1384  countvars+=6;
1385  }else if(countbool==2){
1386  // Note reordered relative to frd file
1387  // Order must be xx yy zz xy xz yz
1388  var_names[countvars++]="ZZS-imagxx";
1389  var_names[countvars++]="ZZS-imagyy";
1390  var_names[countvars++]="ZZS-imagzz";
1391  var_names[countvars++]="ZZS-imagxy";
1392  var_names[countvars++]="ZZS-imagxz";
1393  var_names[countvars++]="ZZS-imagyz";
1394  }else{
1395 
1396  FORTRAN(zienzhu,(co,nk,kon,ipkon,lakon,ne0,stn,ipneigh,neigh,
1397  &stx[6*mi[0]**ne],&mi[0]));
1398 
1399  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
1400  ialset,ngraph,&ncomptensor,ifieldtensor,icomptensor,
1401  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1402  printf ("Warning: export of ZZSTR imaginary to exo not tested.\n");
1403  countvars+=6;
1404  }
1405  }
1406  }
1407 
1408  /* storing the error estimator in the nodes */
1409  if((*nmethod!=5)||(*mode==-1)){
1410  if((strcmp1(&filab[1044],"ERR")==0)&&(*ithermal!=2)){
1411  if (countbool==3){
1412  countvars+=2;
1413  }else if(countbool==2){
1414  var_names[countvars++]="PSTDERROR";
1415  var_names[countvars++]="VMSTDERROR";
1416  }else{
1417 
1418  nterms=6;
1419  FORTRAN(errorestimator,(stx,stn,ipkon,kon,lakon,nk,ne,
1420  mi,ielmat,&nterms,inum,co,vold,&filab[1048]));
1421 
1422  iselect=1;
1423 
1424  frdset(&filab[1044],set,&iset,istartset,iendset,ialset,
1425  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1426  ngraph);
1427 
1428  ncomp=2;
1429  ifield[0]=1;ifield[1]=1;
1430  icomp[0]=0;icomp[1]=1;
1431 
1432  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
1433  ialset,ngraph,&ncomp,ifield,icomp,
1434  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1435 
1436  countvars+=2;
1437  }
1438  }
1439  }
1440 
1441  /* storing the imaginary part of the error estimator in the nodes
1442  for the odd modes of cyclic symmetry calculations */
1443  if((*noddiam>=0)||((*nmethod==5)&&(*mode==0))){
1444  if((strcmp1(&filab[1044],"ERR")==0)&&(*ithermal!=2)){
1445  if (countbool==3){
1446  countvars+=2;
1447  }else if(countbool==2){
1448  var_names[countvars++]="PSTD-imag-ERROR";
1449  var_names[countvars++]="VMSTD-imag-ERROR";
1450  }else{
1451  nterms=6;
1452  FORTRAN(errorestimator,(&stx[6*mi[0]**ne],stn,ipkon,kon,lakon,nk,ne,
1453  mi,ielmat,&nterms,inum,co,vold,&filab[1048]));
1454 
1455  ncomp=2;
1456  ifield[0]=1;ifield[1]=1;
1457  icomp[0]=0;icomp[1]=1;
1458 
1459  exoselect(stn,stn,&iset,&nkcoords,inum,istartset,iendset,
1460  ialset,ngraph,&ncomp,ifield,icomp,
1461  nfieldtensor,&iselect,exoid,num_time_steps,countvars,nout);
1462 
1463  countvars+=2;
1464  }
1465  }
1466  }
1467 
1468  /* storing the thermal error estimator in the nodes */
1469  if((*nmethod!=5)||(*mode==-1)){
1470  if((strcmp1(&filab[2784],"HER")==0)&&(*ithermal>1)){
1471  if (countbool==3){
1472  countvars+=1;
1473  }else if(countbool==2){
1474  var_names[countvars++]="HFLSTD";
1475  }else{
1476  nterms=3;
1477  FORTRAN(errorestimator,(qfx,qfn,ipkon,kon,lakon,nk,ne,
1478  mi,ielmat,&nterms,inum,co,vold,&filab[2788]));
1479 
1480  iselect=1;
1481  frdset(&filab[2784],set,&iset,istartset,iendset,ialset,
1482  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1483  ngraph);
1484 
1485  ncomp=1;
1486  ifield[0]=1;
1487  icomp[0]=1;
1488 
1489  exoselect(qfn,qfn,&iset,&nkcoords,inum,istartset,iendset,
1490  ialset,ngraph,&ncomp,ifield,icomp,
1491  nfieldvector1,&iselect,exoid,num_time_steps,countvars,nout);
1492  countvars+=1;
1493  }
1494  }
1495  }
1496 
1497  /* storing the imaginary part of the thermal error estimator in the nodes
1498  for the odd modes of cyclic symmetry calculations */
1499 
1500  if((*noddiam>=0)||((*nmethod==5)&&(*mode==0))){
1501  if(strcmp1(&filab[2784],"HER")==0){
1502  if (countbool==3){
1503  countvars+=1;
1504  }else if(countbool==2){
1505  var_names[countvars++]="HFLSTD-IMG";
1506  }else{
1507  nterms=3;
1508  FORTRAN(errorestimator,(&qfx[3*mi[0]**ne],qfn,ipkon,kon,lakon,nk,ne,
1509  mi,ielmat,&nterms,inum,co,vold,&filab[2788]));
1510 
1511  ncomp=1;
1512  ifield[0]=1;
1513  icomp[0]=1;
1514 
1515  exoselect(qfn,qfn,&iset,&nkcoords,inum,istartset,iendset,
1516  ialset,ngraph,&ncomp,ifield,icomp,
1517  nfieldvector1,&iselect,exoid,num_time_steps,countvars,nout);
1518 
1519  countvars+=1;
1520  }
1521  }
1522  }
1523 
1524  /* storing the total temperatures in the network nodes */
1525  if((strcmp1(&filab[1131],"TT ")==0)&&(*ithermal>1)){
1526  if (countbool==3){
1527  countvars+=1;
1528  }else if(countbool==2){
1529  var_names[countvars++]="TT";
1530  }else{
1531 
1532  iselect=-1;
1533  frdset(&filab[1131],set,&iset,istartset,iendset,ialset,
1534  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1535  ngraph);
1536 
1537  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1538  ialset,ngraph,&ncompscalar,ifieldscalar,icompscalar,
1539  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1540  printf ("Warning: export of TT to exo not tested.\n");
1541  countvars+=1;
1542  }
1543  }
1544 
1545  /* storing the total temperatures in the network nodes */
1546  if((strcmp1(&filab[1218],"MF ")==0)&&(*ithermal>1)){
1547  if (countbool==3){
1548  countvars+=1;
1549  }else if(countbool==2){
1550  var_names[countvars++]="MF";
1551  }else{
1552 
1553  iselect=-1;
1554  frdset(&filab[1218],set,&iset,istartset,iendset,ialset,
1555  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1556  ngraph);
1557 
1558  icomp[0]=1;
1559  if((iaxial==1)&&(strcmp1(&filab[1222],"I")==0)){for(i=0;i<*nk;i++)v[1+i*mt]*=180.;}
1560  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1561  ialset,ngraph,&ncompscalar,ifieldscalar,icomp,
1562  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1563  if((iaxial==1)&&(strcmp1(&filab[1222],"I")==0)){for(i=0;i<*nk;i++)v[1+i*mt]/=180.;}
1564  countvars+=1;
1565  }
1566  }
1567 
1568  /* storing the total pressure in the network nodes */
1569  if((strcmp1(&filab[1305],"PT ")==0)&&(*ithermal>1)){
1570  if (countbool==3){
1571  countvars+=1;
1572  }else if(countbool==2){
1573  var_names[countvars++]="PT";
1574  }else{
1575 
1576  iselect=-1;
1577  frdset(&filab[1305],set,&iset,istartset,iendset,ialset,
1578  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1579  ngraph);
1580 
1581  icomp[0]=2;
1582  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1583  ialset,ngraph,&ncompscalar,ifieldscalar,icomp,
1584  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1585  countvars+=1;
1586  }
1587  }
1588 
1589  /* storing the static pressure in the liquid network nodes */
1590  if((strcmp1(&filab[1827],"PS ")==0)&&(*ithermal>1)){
1591  if (countbool==3){
1592  countvars+=1;
1593  }else if(countbool==2){
1594  var_names[countvars++]="STPRESS PS";
1595  }else{
1596 
1597  iselect=-1;
1598  frdset(&filab[1827],set,&iset,istartset,iendset,ialset,
1599  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1600  ngraph);
1601 
1602  icomp[0]=2;
1603  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1604  ialset,ngraph,&ncompscalar,ifieldscalar,icomp,
1605  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1606  printf ("Warning: export of PS to exo not tested.\n");
1607  countvars+=1;
1608  }
1609  }
1610 
1611  /* storing the liquid depth in the channel nodes */
1612  if(strcmp1(&filab[2349],"PS ")==0){
1613  if (countbool==3){
1614  countvars+=1;
1615  }else if(countbool==2){
1616  var_names[countvars++]="DEPTH";
1617  }else{
1618 
1619  iselect=-1;
1620  frdset(&filab[2349],set,&iset,istartset,iendset,ialset,
1621  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1622  ngraph);
1623 
1624  icomp[0]=2;
1625  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1626  ialset,ngraph,&ncompscalar,ifieldscalar,icomp,
1627  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1628  printf ("Warning: export of DEPTH to exo not tested.\n");
1629  countvars+=1;
1630  }
1631  }
1632 
1633  /* storing the critical depth in the channel nodes */
1634  if((strcmp1(&filab[2436],"HCRI")==0)&&(*ithermal>1)){
1635  if (countbool==3){
1636  countvars+=1;
1637  }else if(countbool==2){
1638  var_names[countvars++]="HCRIT";
1639  }else{
1640 
1641  iselect=-1;
1642  frdset(&filab[2436],set,&iset,istartset,iendset,ialset,
1643  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1644  ngraph);
1645 
1646  icomp[0]=3;
1647  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1648  ialset,ngraph,&ncompscalar,ifieldscalar,icomp,
1649  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1650  printf ("Warning: export of HCRIT to exo not tested.\n");
1651  countvars+=1;
1652  }
1653  }
1654 
1655  /* storing the static temperature in the network nodes */
1656  if((strcmp1(&filab[1392],"TS ")==0)&&(*ithermal>1)){
1657  if (countbool==3){
1658  countvars+=1;
1659  }else if(countbool==2){
1660  var_names[countvars++]="STTEMP";
1661  }else{
1662 
1663  iselect=-1;
1664  frdset(&filab[1392],set,&iset,istartset,iendset,ialset,
1665  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1666  ngraph);
1667 
1668  icomp[0]=3;
1669  exoselect(v,v,&iset,&nkcoords,inum,istartset,iendset,
1670  ialset,ngraph,&ncompscalar,ifieldscalar,icomp,
1671  nfieldvector0,&iselect,exoid,num_time_steps,countvars,nout);
1672  printf ("Warning: export of STTEMP to exo not tested.\n");
1673  countvars+=1;
1674  }
1675  }
1676 
1677  /* the remaining lines only apply to frequency calculations
1678  with cyclic symmetry, complex frequency and steady state calculations */
1679 
1680  if((*nmethod!=2)&&(*nmethod!=5)&&(*nmethod!=6)&&(*nmethod!=7)){goto WRITENAMES;}
1681  if((*nmethod==5)&&(*mode==-1)){goto WRITENAMES;}
1682 
1683  /* storing the displacements in the nodes (magnitude, phase) */
1684  if((strcmp1(&filab[870],"PU ")==0)&&(*ithermal!=2)){
1685  if (countbool==3){
1686  countvars+=6;
1687  }else if(countbool==2){
1688  // Note reordered relative to frd file
1689  // Order must be xx yy zz xy xz yz
1690  var_names[countvars++]="PDISP-MAGx";
1691  var_names[countvars++]="PDISP-MAGy";
1692  var_names[countvars++]="PDISP-MAGz";
1693  var_names[countvars++]="PDISP-PHAx";
1694  var_names[countvars++]="PDISP-PHAz";
1695  var_names[countvars++]="PDISP-PHAy";
1696  }else{
1697  iselect=1;
1698 
1699  frdset(&filab[870],set,&iset,istartset,iendset,ialset,
1700  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1701  ngraph);
1702 
1703  exoselect(vr,vi,&iset,&nkcoords,inum,istartset,iendset,
1704  ialset,ngraph,&ncompvectph,ifieldvectph,icompvectph,
1705  nfieldvectph,&iselect,exoid,num_time_steps,countvars,nout);
1706  countvars+=6;
1707  }
1708  }
1709 
1710  /* storing the temperatures in the nodes (magnitude, phase) */
1711  if((strcmp1(&filab[957],"PNT ")==0)&&(*ithermal>1)){
1712  if (countbool==3){
1713  countvars+=2;
1714  }else if(countbool==2){
1715  var_names[countvars++]="PNDTEMP MAG1";
1716  var_names[countvars++]="PNDTEMP PHA2";
1717  }else{
1718  iselect=1;
1719 
1720  frdset(&filab[957],set,&iset,istartset,iendset,ialset,
1721  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1722  ngraph);
1723 
1724  exoselect(vr,vi,&iset,&nkcoords,inum,istartset,iendset,
1725  ialset,ngraph,&ncompscalph,ifieldscalph,icompscalph,
1726  nfieldscalph,&iselect,exoid,num_time_steps,countvars,nout);
1727  printf ("Warning: export of PNDTEMP to exo not tested.\n");
1728  countvars+=2;
1729  }
1730  }
1731 
1732  /* storing the stresses in the nodes (magnitude, phase) */
1733 
1734  if((strcmp1(&filab[1479],"PHS ")==0)&&(*ithermal!=2)){
1735  if (countbool==3){
1736  countvars+=12;
1737  }else if(countbool==2){
1738  // Note reordered relative to frd file
1739  // Order must be xx yy zz xy xz yz
1740  var_names[countvars++]="PSTRESS MAGXX";
1741  var_names[countvars++]="PSTRESS MAGYY";
1742  var_names[countvars++]="PSTRESS MAGZZ";
1743  var_names[countvars++]="PSTRESS MAGXY";
1744  var_names[countvars++]="PSTRESS MAGXZ";
1745  var_names[countvars++]="PSTRESS MAGYZ";
1746  var_names[countvars++]="PSTRESS PHAXX";
1747  var_names[countvars++]="PSTRESS PHAYY";
1748  var_names[countvars++]="PSTRESS PHAZZ";
1749  var_names[countvars++]="PSTRESS PHAXY";
1750  var_names[countvars++]="PSTRESS PHAXZ";
1751  var_names[countvars++]="PSTRESS PHAYZ";
1752  }else{
1753  iselect=1;
1754 
1755  frdset(&filab[1479],set,&iset,istartset,iendset,ialset,
1756  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1757  ngraph);
1758 
1759  exoselect(stnr,stni,&iset,&nkcoords,inum,istartset,iendset,
1760  ialset,ngraph,&ncomptensph,ifieldtensph,icomptensph,
1761  nfieldtensph,&iselect,exoid,num_time_steps,countvars,nout);
1762  countvars+=12;
1763  }
1764  }
1765 
1766  /* storing the differential contact displacements and
1767  the contact stresses in the nodes (magnitude, phase)
1768  only for face-to-face penalty contact */
1769  if((strcmp1(&filab[3915],"PCON")==0)&&(*ithermal!=2)&&(*mortar==1)){
1770  if (countbool==3){
1771  countvars+=12;
1772  }else if(countbool==2){
1773  // NOT SURE IF THE ORDER IS CORRECT HERE... ORDERING GETS
1774  // CHANGED IN EXOSELECT
1775  var_names[countvars++]="MAGO ";
1776  var_names[countvars++]="MAGSL1";
1777  var_names[countvars++]="MAGSL2";
1778  var_names[countvars++]="MAGP ";
1779  var_names[countvars++]="MAGSH1";
1780  var_names[countvars++]="MAGSH2";
1781  var_names[countvars++]="PHAO ";
1782  var_names[countvars++]="PHASL1";
1783  var_names[countvars++]="PHASL2";
1784  var_names[countvars++]="PHAP ";
1785  var_names[countvars++]="PHASH1";
1786  var_names[countvars++]="PHASH2";
1787  }else{
1788  iselect=1;
1789 
1790  frdset(&filab[3915],set,&iset,istartset,iendset,ialset,
1791  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1792  ngraph);
1793 
1794  exoselect(cdnr,cdni,&iset,&nkcoords,inum,istartset,iendset,
1795  ialset,ngraph,&ncomptensph,ifieldtensph,icomptensph,
1796  nfieldtensph,&iselect,exoid,num_time_steps,countvars,nout);
1797  countvars+=12;
1798  printf ("Warning: export PCON to exo not tested and likely has incorrect ordering.\n");
1799  }
1800  }
1801 
1802  /* storing the displacements in the nodes (magnitude, phase) */
1803  if(strcmp1(&filab[2610],"PRF ")==0){
1804  if (countbool==3){
1805  countvars+=6;
1806  }else if(countbool==2){
1807  // Note reordered relative to frd file
1808  // Order must be xx yy zz xy xz yz
1809  var_names[countvars++]="PFORC MAG1";
1810  var_names[countvars++]="PFORC MAG2";
1811  var_names[countvars++]="PFORC MAG3";
1812  var_names[countvars++]="PFORC PHA1";
1813  var_names[countvars++]="PFORC PHA3";
1814  var_names[countvars++]="PFORC PHA2";
1815  }else{
1816  iselect=1;
1817 
1818  frdset(&filab[2610],set,&iset,istartset,iendset,ialset,
1819  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1820  ngraph);
1821 
1822  exoselect(fnr,fni,&iset,&nkcoords,inum,istartset,iendset,
1823  ialset,ngraph,&ncompvectph,ifieldvectph,icompvectph,
1824  nfieldvectph,&iselect,exoid,num_time_steps,countvars,nout);
1825  printf ("Warning: export of PFORC to exo not tested.\n");
1826  countvars+=6;
1827  }
1828  }
1829 
1830  /* the remaining parts are for frequency calculations with cyclic symmetry only */
1831  if(*nmethod!=2){goto WRITENAMES;}
1832 
1833  /* storing the maximum displacements of the nodes in the base sector
1834  (components, magnitude) */
1835 
1836  if((strcmp1(&filab[1566],"MAXU")==0)&&(*ithermal!=2)){
1837  if (countbool==3){
1838  countvars+=4;
1839  }else if(countbool==2){
1840  var_names[countvars++]="MDISP DX";
1841  var_names[countvars++]="MDISP DY";
1842  var_names[countvars++]="MDISP DZ";
1843  var_names[countvars++]="MDISP ANG";
1844  }else{
1845  iselect=1;
1846 
1847  frdset(&filab[1566],set,&iset,istartset,iendset,ialset,
1848  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1849  ngraph);
1850 
1851  ncomp=4;
1852  ifield[0]=1;icomp[0]=1;
1853  ifield[1]=1;icomp[1]=2;
1854  ifield[2]=1;icomp[2]=3;
1855  ifield[3]=1;icomp[3]=0;
1856  nfield[0]=4;nfield[1]=4;
1857 
1858  exoselect(vmax,vmax,&iset,&nkcoords,inum,istartset,iendset,
1859  ialset,ngraph,&ncomp,ifield,icomp,
1860  nfield,&iselect,exoid,num_time_steps,countvars,nout);
1861  printf ("Warning: export of MDISP to exo not tested.\n");
1862  countvars+=4;
1863  }
1864  }
1865 
1866  /* storing the worst principal stress at the nodes in the basis
1867  sector (components, magnitude)
1868 
1869  the worst principal stress is the maximum of the absolute value
1870  of all principal stresses, times its original sign */
1871 
1872  if((strcmp1(&filab[1653],"MAXS")==0)&&(*ithermal!=2)){
1873  if (countbool==3){
1874  countvars+=7;
1875  }else if(countbool==2){
1876  // Note reordered relative to frd file
1877  // Order must be xx yy zz xy xz yz
1878  var_names[countvars++]="MSTRESS SXX";
1879  var_names[countvars++]="MSTRESS SYY";
1880  var_names[countvars++]="MSTRESS SZZ";
1881  var_names[countvars++]="MSTRESS SXY";
1882  var_names[countvars++]="MSTRESS SXZ";
1883  var_names[countvars++]="MSTRESS SYZ";
1884  var_names[countvars++]="MSTRESS MAG";
1885  }else{
1886  iselect=1;
1887 
1888  frdset(&filab[1653],set,&iset,istartset,iendset,ialset,
1889  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1890  ngraph);
1891 
1892  ncomp=7;
1893  ifield[0]=1;icomp[0]=1;
1894  ifield[1]=1;icomp[1]=2;
1895  ifield[2]=1;icomp[2]=3;
1896  ifield[3]=1;icomp[3]=4;
1897  ifield[4]=1;icomp[4]=6;
1898  ifield[5]=1;icomp[5]=5;
1899  ifield[6]=1;icomp[6]=0;
1900  nfield[0]=7;nfield[1]=7;
1901 
1902  exoselect(stnmax,stnmax,&iset,&nkcoords,inum,istartset,iendset,
1903  ialset,ngraph,&ncomp,ifield,icomp,
1904  nfield,&iselect,exoid,num_time_steps,countvars,nout);
1905  printf ("Warning: export of MSTRESS to exo not tested.\n");
1906  countvars+=7;
1907  }
1908  }
1909 
1910  /* storing the worst principal strain at the nodes
1911  in the basis sector (components, magnitude)
1912 
1913  the worst principal strain is the maximum of the
1914  absolute value of all principal strains, times
1915  its original sign */
1916  if((strcmp1(&filab[2523],"MAXE")==0)&&(*ithermal!=2)){
1917  if (countbool==3){
1918  countvars+=7;
1919  }else if(countbool==2){
1920  // Note reordered relative to frd file
1921  // Order must be xx yy zz xy xz yz
1922  var_names[countvars++]="MAXE EXX";
1923  var_names[countvars++]="MAXE EYY";
1924  var_names[countvars++]="MAXE EZZ";
1925  var_names[countvars++]="MAXE EXY";
1926  var_names[countvars++]="MAXE EXZ";
1927  var_names[countvars++]="MAXE EYZ";
1928  var_names[countvars++]="MAXE MAG";
1929  }else{
1930  iselect=1;
1931 
1932  frdset(&filab[2523],set,&iset,istartset,iendset,ialset,
1933  inum,&noutloc,&nout,nset,&noutmin,&noutplus,&iselect,
1934  ngraph);
1935 
1936  ncomp=7;
1937  ifield[0]=1;icomp[0]=1;
1938  ifield[1]=1;icomp[1]=2;
1939  ifield[2]=1;icomp[2]=3;
1940  ifield[3]=1;icomp[3]=4;
1941  ifield[4]=1;icomp[4]=6;
1942  ifield[5]=1;icomp[5]=5;
1943  ifield[6]=1;icomp[6]=0;
1944  nfield[0]=7;nfield[1]=7;
1945 
1946  exoselect(eenmax,eenmax,&iset,&nkcoords,inum,istartset,iendset,
1947  ialset,ngraph,&ncomp,ifield,icomp,
1948  nfield,&iselect,exoid,num_time_steps,countvars,nout);
1949  printf ("Warning: export of MAXE to exo not tested.\n");
1950  countvars+=7;
1951  }
1952  }
1953 
1954  WRITENAMES:
1955  if (countbool==3){
1956  errr = ex_put_var_param (exoid, "n", countvars);
1957  ex_update (exoid);
1958  // var_names = (char *) calloc (countvars, sizeof (char));
1959  // var_names = (char *) calloc (countvars, MAX_STR_LENGTH);
1960  int ii=0; // 4 bit integer
1961  for (ii=0; ii<countvars; ii++)
1962  {
1963  var_names[ii] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
1964  }
1965  }else if(countbool==2){
1966  errr = ex_put_var_names (exoid, "n", countvars, var_names);
1967  if (errr) {
1968  printf ("Unable to update variable names. Was output data requested?\n\n");
1969  printf (" NOTE CalculiX Extras doesn't currently support\n");
1970  printf (" changing output variables between steps.\n");
1971  printf (" Requested output variables in this step are:\n");
1972  int ii=0; // 4 bit integer
1973  for (ii=0; ii<countvars; ii++){
1974  printf(" %i %s\n", ii+1, var_names[ii]);
1975  }
1976  }
1977 
1978  // for (i=0; i<countvars; i++)
1979  // {
1980  // free(var_names[i]);
1981  // }
1982  ex_update (exoid);
1983  }
1984 
1985  countvars=0;
1986  // printf ("Decrement countbool to %i\n",--countbool);
1987  --countbool;
1988  };
1989 
1990  // free (var_names);
1991  free (node_map_inv);
1992  ex_update (exoid);
1993  ex_close(exoid);
1994  return;
1995 }
#define ITGFORMAT
Definition: CalculiX.h:52
ITG strcmp2(const char *s1, const char *s2, ITG length)
Definition: strcmp2.c:24
ITG strcpy1(char *s1, const char *s2, ITG length)
Definition: strcpy1.c:24
void FORTRAN(actideacti,(char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, char *objectset, ITG *ipkon, ITG *ibject, ITG *ne))
ITG strcmp1(const char *s1, const char *s2)
Definition: strcmp1.c:24
void exoselect(double *field1, double *field2, ITG *iset, ITG *nkcoords, ITG *inum, ITG *istartset, ITG *iendset, ITG *ialset, ITG *ngraph, ITG *ncomp, ITG *ifield, ITG *icomp, ITG *nfield, ITG *iselect, ITG exoid, ITG time_step, int countvar, ITG nout)
Definition: exoselect.c:31
static double * f1
Definition: objectivemain_se.c:47
void exosetfind(char *set, ITG *nset, ITG *ialset, ITG *istartset, ITG *iendset, ITG *num_ns, ITG *num_ss, ITG *num_es, ITG *num_fs, ITG *node_map_inv, int exoid, int store, ITG *nk)
Definition: exosetfind.c:28
subroutine nodes(inpc, textpart, co, nk, nk_, set, istartset, iendset, ialset, nset, nset_, nalset, nalset_, istep, istat, n, iline, ipol, inl, ipoinp, inp, ipoinpc)
Definition: nodes.f:22
subroutine zienzhu(co, nk, kon, ipkon, lakon, ne, stn, ipneigh, neigh, sti, mi)
Definition: zienzhu.f:21
void frdset(char *filabl, char *set, ITG *iset, ITG *istartset, ITG *iendset, ITG *ialset, ITG *inum, ITG *noutloc, ITG *nout, ITG *nset, ITG *noutmin, ITG *noutplus, ITG *iselect, ITG *ngraph)
Definition: frdset.c:24
#define ITG
Definition: CalculiX.h:51
void exovector(double *v, ITG *iset, ITG *ntrans, char *filabl, ITG *nkcoords, ITG *inum, char *m1, ITG *inotr, double *trab, double *co, ITG *istartset, ITG *iendset, ITG *ialset, ITG *mi, ITG *ngraph, FILE *f1, char *output, char *m3, int exoid, ITG time_step, int countvar, ITG nout)
Definition: exovector.c:28
subroutine errorestimator(yi, yn, ipkon, kon, lakon, nk, ne, mi, ielmat, nterms, inum, co, vold, cflag)
Definition: errorestimator.f:21

◆ exoselect()

void exoselect ( double *  field1,
double *  field2,
ITG iset,
ITG nkcoords,
ITG inum,
ITG istartset,
ITG iendset,
ITG ialset,
ITG ngraph,
ITG ncomp,
ITG ifield,
ITG icomp,
ITG nfield,
ITG iselect,
ITG  exoid,
ITG  time_step,
int  countvar,
ITG  nout 
)
34  {
35 
36  /* storing scalars, components of vectors and tensors without additional
37  transformations */
38 
39  /* number of components in field1: nfield[0]
40  number of components in field2: nfield[1]
41 
42  number of entities to store: ncomp
43  for each entity i, 0<=i<ncomp:
44  - ifield[i]: 1=field1,2=field2
45  - icomp[i]: component: 0...,(nfield[0]-1 or nfield[1]-1) */
46 
47  ITG i,j,k,l,m,o,nksegment;
48  /* When initializing parameter values:
49  "g" (or "G")
50  For global variables.
51  "n" (or "N")
52  For nodal variables.
53  "e" (or "E")
54  For element variables.
55  "m" (or "M")
56  For nodeset variables.
57  "s" (or "S")
58  For sideset variables.
59  */
60  // ITG num_nod_vars = *ncomp;
61  float *nodal_var_vals;
62  nodal_var_vals = (float *) calloc (nout, sizeof(float));
63 
64 
65  for(j=0;j<*ncomp;j++){
66  if(*iset==0){
67  m=0;
68  for(i=0;i<*nkcoords;i++){
69  /* check whether output is requested for solid nodes or
70  network nodes */
71 
72  if(*iselect==1){
73  if(inum[i]<=0) continue;
74  }else if(*iselect==-1){
75  if(inum[i]>=0) continue;
76  }else{
77  if(inum[i]==0) continue;
78  }
79 
80  /* storing the entities */
81  if(ifield[j]==1){
82  nodal_var_vals[m]=field1[i*nfield[0]+icomp[j]];
83  }else{
84  nodal_var_vals[m]=field2[i*nfield[1]+icomp[j]];
85  }
86  m++;
87  }
88  }else{
89  nksegment=(*nkcoords)/(*ngraph);
90  m=0;
91  for(k=istartset[*iset-1]-1;k<iendset[*iset-1];k++){
92  if(ialset[k]>0){
93 
94  for(l=0;l<*ngraph;l++){
95  i=ialset[k]+l*nksegment-1;
96 
97  /* check whether output is requested for solid nodes or
98  network nodes */
99 
100  if(*iselect==1){
101  if(inum[i]<=0) continue;
102  }else if(*iselect==-1){
103  if(inum[i]>=0) continue;
104  }else{
105  if(inum[i]==0) continue;
106  }
107 
108  /* storing the entities */
109  if(ifield[j]==1){
110  nodal_var_vals[m]=field1[i*nfield[0]+icomp[j]];
111  }else{
112  nodal_var_vals[m]=field2[i*nfield[1]+icomp[j]];
113  }
114  m++;
115  }
116  }else{
117  l=ialset[k-2];
118  do{
119  l-=ialset[k];
120  if(l>=ialset[k-1]) break;
121  o=0;
122  for(m=0;m<*ngraph;m++){
123  i=l+m*nksegment-1;
124 
125  /* check whether output is requested for solid nodes or
126  network nodes */
127 
128  if(*iselect==1){
129  if(inum[i]<=0) continue;
130  }else if(*iselect==-1){
131  if(inum[i]>=0) continue;
132  }else{
133  if(inum[i]==0) continue;
134  }
135 
136  /* storing the entities */
137  if(ifield[j]==1){
138  nodal_var_vals[o]=field1[i*nfield[0]+icomp[j]];
139  }else{
140  nodal_var_vals[o]=field2[i*nfield[1]+icomp[j]];
141  }
142  }
143  o++;
144  printf ("%f\n",nodal_var_vals[m]);
145  }while(1);
146  }
147  }
148  }
149 
150  // Note: the results for exo tensor format are strangely ordered,
151  if (*ncomp==12){
152  k=j;
153  }else{k=j;}
154 
155  int errr = ex_put_nodal_var (exoid, time_step, k+1+countvar, nout, nodal_var_vals);
156  if (errr) printf ("ERROR exoselect data for dim %i record %i.\n", j, countvar+j);
157  }
158 
159  free(nodal_var_vals);
160  return;
161 
162 }
#define ITG
Definition: CalculiX.h:51

◆ exoset_check()

ITG exoset_check ( ITG  n,
ITG node_map_inv,
ITG nk,
int *  dropped,
int *  unidentified 
)
188  {
189  ITG val=0;
190  // printf ("%" ITGFORMAT ", %" ITGFORMAT "\n", n, *nk);
191  if (n<=*nk){
192  val = node_map_inv[n]-1;
193  // printf ("val node number %" ITGFORMAT "\n", val+1);
194  if (val==-1) {
195  *dropped = 1;
196  }
197  }else{
198  // printf("UNIDENTIFIED %" ITGFORMAT "\n", n);
199  *unidentified = 1;
200  }
201  return val;
202 }
#define ITG
Definition: CalculiX.h:51

◆ exosetfind()

void exosetfind ( char *  set,
ITG nset,
ITG ialset,
ITG istartset,
ITG iendset,
ITG num_ns,
ITG num_ss,
ITG num_es,
ITG num_fs,
ITG node_map_inv,
int  exoid,
int  store,
ITG nk 
)
30  {
31 
32  ITG i,j,k,l,n,s,e,gen;
33  char tmpstr[81];
34  char *space = " ";
35  char *pos;
36  ITG *set_nums;
37  int errr;
38  int dropped=0, unidentified=0;
39 
40  *num_ns = 0;
41  *num_ss = 0;
42  *num_es = 0;
43  *num_fs = 0;
44 
45  for (i=0; i<*nset; i++){
46 
47  if (store) {
48  // Find and store the set numbers
49  // The pointer integers are 1 based (fortran)
50  s=istartset[i]-1;
51  e=iendset[i]-1;
52  // Determine if generate was used
53  gen=0; l=0;
54  for (j=s; j<=e; j++){
55  if (ialset[j]<0) {
56  gen+=(ialset[j-1]-ialset[j-2])/(-ialset[j])+1;
57  l-=3;
58  }
59  }
60 
61  // Now set the length of the set allocation
62  l=e-s+1+gen+l;
63  set_nums = (ITG *) calloc(l, sizeof(ITG));
64 
65  /* Only add the generate code if there are at least
66  three points in the vector */
67  n=0; j=s;
68  if (l>2){
69  while (j<=e-2){
70  // Account for generated ids
71  if (ialset[j+2]<0) {
72  for (k=ialset[j]; k<=ialset[j+1]; k-=ialset[j+2]){
73  set_nums[n++]=exoset_check(k-1, node_map_inv, nk, &dropped, &unidentified);
74  }
75  j+=3;
76  }else{
77  // Account for directly added id
78  gen=ialset[j++]-1;
79  set_nums[n++]=exoset_check(gen, node_map_inv, nk, &dropped, &unidentified);
80  }
81  }
82  // Must finish the last two of directly added set
83  if (ialset[e]>0){ // only if the last set is not a generated set
84  // 1+n++ and -1+n++ to preserve order
85  set_nums[1+n++]=exoset_check(ialset[e]-2, node_map_inv, nk, &dropped, &unidentified);
86  if (ialset[e-1]>0){
87  set_nums[-1+n++]=exoset_check(ialset[e]-3, node_map_inv, nk, &dropped, &unidentified);
88  }
89  }
90  }else if(l>1){
91  set_nums[n++]=exoset_check(ialset[s]-1, node_map_inv, nk, &dropped, &unidentified);
92  set_nums[n++]=exoset_check(ialset[e]-1, node_map_inv, nk, &dropped, &unidentified);
93  }else{
94  set_nums[n++]=exoset_check(ialset[e]-1, node_map_inv, nk, &dropped, &unidentified);
95  }
96  } // if (store)
97 
98  strncpy(tmpstr,set+i*81,81);
99  pos = strpbrk(tmpstr, space)-1;
100 
101  if(strcmp1(pos,"N")==0){
102  (*num_ns)++; // printf ("Node set identified\n");
103  if (store){
104  errr = ex_put_node_set_param (exoid, i, n, 0); // CURRENTLY NO DISTRIBUTIONS ADDED
105  if (errr) printf ("Error writing set parameters\n");
106  errr = ex_put_node_set (exoid, i, set_nums);
107  if (errr) printf ("Error writing set numbers\n");
108  // ex_put_node_set_dist_fact (exoid, i, set_nums); //
109  }
110  }
111  if(strcmp1(pos,"E")==0) {
112  (*num_es)++; // printf ("Element set identified\n");}
113  /* No element set storage mechanism?
114  if (store){
115  errr = ex_put_elem_set_param (exoid, i, n, 0);
116  if (errr) printf ("Error writing set parameters\n");
117  errr = ex_put_elem_set (exoid, i, set_nums);
118  if (errr) printf ("Error writing set numbers\n");
119  // ex_put_elem_set_dist_fact (exoid, i, set_nums); //
120  } */
121  }
122  if(strcmp1(pos,"S")==0) {
123  (*num_ss)++; // printf ("Node side set surface identified\n");}
124  /* Side sets (node surfaces) not yet implemented
125  if (store){
126  errr = ex_put_side_set_param (exoid, i, n, 0);
127  if (errr) printf ("Error writing set parameters\n");
128  errr = ex_put_side_set (exoid, i, set_nums);
129  if (errr) printf ("Error writing set numbers\n");
130  // ex_put_side_set_dist_fact (exoid, i, set_nums); //
131  } */
132  }
133  if(strcmp1(pos,"T")==0) {
134  (*num_fs)++; // printf ("Face set surface identified\n");}
135  /* Face sets not yet implemented
136  if (store){
137  errr = ex_put_face_set_param (exoid, i, n, 0);
138  if (errr) printf ("Error writing set parameters\n");
139  errr = ex_put_face_set (exoid, i, set_nums);
140  if (errr) printf ("Error writing set numbers\n");
141  // ex_put_face_set_dist_fact (exoid, i, set_nums); //
142  } */
143  }
144  if (store) {free (set_nums);}
145  }
146 
147  if (store){
148  // char *namesnset[*num_ns]; j=0;
149  // char *namessset[*num_ss]; k=0;
150  // char *nameseset[*num_es]; l=0;
151  // char *namesfset[*num_fs]; n=0;
152 
153  for (i=0; i<*nset; i++){
154  strncpy(tmpstr,set+i*81,81);
155  pos = strpbrk(tmpstr, space)-1;
156  // This crashed in valgrind
157  // if(strcmp1(pos,"N")==0) {strncpy(namesnset[j++], tmpstr, MAX_STR_LENGTH);}
158  // if(strcmp1(pos,"E")==0) {strcpy(nameseset[l++],tmpstr);}
159  // if(strcmp1(pos,"S")==0) {strcpy(namessset[k++],tmpstr);}
160  // if(strcmp1(pos,"T")==0) {strcpy(namesfset[n++],tmpstr);}
161  }
162 
163  // if (*num_ns>0){
164  // errr = ex_put_names (exoid, EX_NODE_SET, namesnset);
165  // if (errr) printf ("Error writing node set names\n");
166  // }
167  /* side sets not implemented yet
168  if (*num_ss>0){
169  errr = ex_put_names (exoid, EX_SIDE_SET, namessset);
170  if (errr) printf ("Error writing side set names\n");
171  }
172  */
173  }
174 
175  if (dropped){
176  printf ("\nExodus Output WARNING: At least one node or element is dropped from a set.\n");
177  printf (" This may be due rigid bodies or 3D expansion (beams, shells, OUTPUT=3D).\n\n");
178  }
179 
180  if (unidentified){
181  printf ("\nExodus Output WARNING: At least one unidentified node or element is dropped from a set.\n\n");
182  }
183 
184  return;
185 }
ITG strcmp1(const char *s1, const char *s2)
Definition: strcmp1.c:24
#define ITG
Definition: CalculiX.h:51
ITG exoset_check(ITG n, ITG *node_map_inv, ITG *nk, int *dropped, int *unidentified)
Definition: exosetfind.c:188

◆ exovector()

void exovector ( double *  v,
ITG iset,
ITG ntrans,
char *  filabl,
ITG nkcoords,
ITG inum,
char *  m1,
ITG inotr,
double *  trab,
double *  co,
ITG istartset,
ITG iendset,
ITG ialset,
ITG mi,
ITG ngraph,
FILE *  f1,
char *  output,
char *  m3,
int  exoid,
ITG  time_step,
int  countvar,
ITG  nout 
)
32  {
33 
34  ITG nksegment;
35  ITG i,j,k,l,m,n,ii,jj,kk;
36 
37  double a[9];
38 
39  /* When initializing parameter values:
40  "g" (or "G")
41  For global variables.
42  "n" (or "N")
43  For nodal variables.
44  "e" (or "E")
45  For element variables.
46  "m" (or "M")
47  For nodeset variables.
48  "s" (or "S")
49  For sideset variables.
50  */
51 
52  int errr;
53 
54  int num_nod_vars=3;
55 
56  float *nodal_var_vals;
57  nodal_var_vals = (float *) calloc (nout, sizeof(float));
58 
59  for (j=1; j<=num_nod_vars; j++){ // For each direction
60  if(*iset==0){
61  m=0;
62  if((*ntrans==0)||(strcmp1(&filabl[5],"G")==0)){
63  for(i=0;i<*nkcoords;i++){
64  if(inum[i]<=0) continue;
65  nodal_var_vals[m++]=v[(mi[1]+1)*i+j];
66  }
67  }else{
68  for(i=0;i<*nkcoords;i++){
69  if(inum[i]<=0) continue;
70  if(inotr[2*i]==0){
71  nodal_var_vals[m++]=v[(mi[1]+1)*i+j];
72  }else{
73  ii=(mi[1]+1)*i+1;
74  jj=(mi[1]+1)*i+2;
75  kk=(mi[1]+1)*i+3;
76  FORTRAN(transformatrix,(&trab[7*(inotr[2*i]-1)],&co[3*i],a));
77  nodal_var_vals[m++]=v[ii]*a[0+(j-1)*3]+v[jj]*a[1+(j-1)*3]+v[kk]*a[2+(j-1)*3];
78  }
79  }
80  }
81  }else{
82  nksegment=(*nkcoords)/(*ngraph);
83  m=0;
84  for(k=istartset[*iset-1]-1;k<iendset[*iset-1];k++){
85  if(ialset[k]>0){
86  for(l=0;l<*ngraph;l++){
87  i=ialset[k]+l*nksegment-1;
88  if(inum[i]<=0) continue;
89  if((*ntrans==0)||(strcmp1(&filabl[5],"G")==0)||(inotr[2*i]==0)){
90  nodal_var_vals[m++]=v[(mi[1]+1)*i+j];
91  }else{
92  FORTRAN(transformatrix,(&trab[7*(inotr[2*i]-1)],&co[3*i],a));
93  ii=(mi[1]+1)*i+1;
94  jj=(mi[1]+1)*i+2;
95  kk=(mi[1]+1)*i+3;
96  nodal_var_vals[m++]=v[ii]*a[0+(j-1)*3]+v[jj]*a[1+(j-1)*3]+v[kk]*a[2+(j-1)*3];
97  }
98  }
99  }else{
100  l=ialset[k-2];
101  do{
102  l-=ialset[k];
103  if(l>=ialset[k-1]) break;
104  n=0;
105  for(m=0;m<*ngraph;m++){
106  i=l+m*nksegment-1;
107  if(inum[i]<=0) continue;
108  if((*ntrans==0)||(strcmp1(&filabl[5],"G")==0)||(inotr[2*i]==0)){
109  nodal_var_vals[n++]=v[(mi[1]+1)*i+j];
110  }else{
111  FORTRAN(transformatrix,(&trab[7*(inotr[2*i]-1)],&co[3*i],a));
112  ii=(mi[1]+1)*i+1;
113  jj=(mi[1]+1)*i+2;
114  kk=(mi[1]+1)*i+3;
115  nodal_var_vals[n++]=v[ii]*a[0+(j-1)*3]+v[jj]*a[1+(j-1)*3]+v[kk]*a[2+(j-1)*3];
116  }
117  }
118  }while(1);
119  }
120  }
121  }
122 
123  errr = ex_put_nodal_var (exoid, time_step, j+countvar, nout, nodal_var_vals);
124  if (errr) printf ("ERROR storing vector data into exo file.\n");
125  }
126 
127  free(nodal_var_vals);
128  return;
129 
130 }
void FORTRAN(actideacti,(char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, char *objectset, ITG *ipkon, ITG *ibject, ITG *ne))
ITG strcmp1(const char *s1, const char *s2)
Definition: strcmp1.c:24
subroutine transformatrix(xab, p, a)
Definition: transformatrix.f:20
#define ITG
Definition: CalculiX.h:51
Hosted by OpenAircraft.com, (Michigan UAV, LLC)