CalculiX  2.8 A Free Software Three-Dimensional Structural Finite Element Program
exoselect.c File Reference
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "CalculiX.h"
#include "exodusII.h"
#include "exo.h"
Include dependency graph for exoselect.c:

Go to the source code of this file.

## Macros

#define min(a, b)   ((a) <= (b) ? (a) : (b))

#define max(a, b)   ((a) >= (b) ? (a) : (b))

## Functions

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)

## Macro Definition Documentation

 #define max ( a, b ) ((a) >= (b) ? (a) : (b))

Definition at line 29 of file exoselect.c.

 #define min ( a, b ) ((a) <= (b) ? (a) : (b))

Definition at line 28 of file exoselect.c.

## Function Documentation

 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 at line 31 of file exoselect.c.

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  for(k=istartset[*iset-1]-1;k<iendset[*iset-1];k++){
91  if(ialset[k]>0){
92
93  m=0;
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: reorder the results for exo tensor format
151  if (*ncomp==12){
152  k=j;
153  }else if (j==4){
154  k=5;
155  }else if(j==5){
156  k=4;
157  }else{k=j;}
158
159  int errr = ex_put_nodal_var (exoid, time_step, k+1+countvar, nout, nodal_var_vals);
160  if (errr) printf ("ERROR exoselect data for dim %i record %i.\n", j, countvar+j);
161  }
162
163  free(nodal_var_vals);
164  return;
165
166 }
#define ITG
Definition: CalculiX.h:51
Hosted by OpenAircraft.com, (Michigan UAV, LLC)