CalculiX  2.8
A Free Software Three-Dimensional Structural Finite Element Program
 All Classes Files Functions Variables Macros
mastructrad.c File Reference
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "CalculiX.h"
Include dependency graph for mastructrad.c:

Go to the source code of this file.

Functions

void mastructrad (ITG *ntr, ITG *nloadtr, char *sideload, ITG *ipointerrad, ITG **mast1radp, ITG **irowradp, ITG *nzsrad, ITG *jqrad, ITG *icolrad)
 

Function Documentation

void mastructrad ( ITG ntr,
ITG nloadtr,
char *  sideload,
ITG ipointerrad,
ITG **  mast1radp,
ITG **  irowradp,
ITG nzsrad,
ITG jqrad,
ITG icolrad 
)

Definition at line 24 of file mastructrad.c.

26  {
27 
28 /* determining the structure of the viewfactor and the radiation
29  matrix (both have the same structure). Only the structure of the
30  lower half of the matrix is determined, since the structure of
31  the upper half is identical */
32 
33  char crcav[4]=" \0";
34 
35  ITG three=3,i,j,k,l,ii,jj,icav,jcav,*mast1rad=NULL,*irowrad=NULL,
36  ifree,nzsrad_,nmast,isubtract,isize,kflag,istart,istartold;
37 
38  mast1rad=*mast1radp;
39  irowrad=*irowradp;
40 
41  kflag=2;
42  nzsrad_=*nzsrad;
43 
44  /* determining the position of each nonzero matrix element in
45  the SUPERdiagonal matrix */
46 
47  ifree=0;
48 
49  for(ii=1;ii<=*ntr;ii++){
50  i=nloadtr[ii-1]-1;
51  strcpy1(crcav,&sideload[20*i+17],three);
52  icav=atoi(crcav);
53  for(jj=1;jj<=ii;jj++){
54  j=nloadtr[jj-1]-1;
55  strcpy1(crcav,&sideload[20*j+17],three);
56  jcav=atoi(crcav);
57  if(icav==jcav){
58  insertrad(ipointerrad,&mast1rad,&irowrad,&ii,
59  &jj,&ifree,&nzsrad_);
60  }
61  }
62  }
63 
64  /* storing the nonzero nodes in the SUPERdiagonal columns:
65  mast1rad contains the row numbers (already done),
66  irowrad the column numbers (done in the next lines) */
67 
68  for(i=0;i<*ntr;++i){
69  if(ipointerrad[i]==0){
70  printf("*ERROR in mastructrad: zero column\n");
71  printf(" DOF=%" ITGFORMAT "\n",i);
72  FORTRAN(stop,());
73  }
74  istart=ipointerrad[i];
75  while(1){
76  istartold=istart;
77  istart=irowrad[istart-1];
78  irowrad[istartold-1]=i+1;
79  if(istart==0) break;
80  }
81  }
82 
83  nmast=ifree;
84 
85  /* summary */
86 
87  printf(" number of radiation equations\n");
88  printf(" %" ITGFORMAT "\n",*ntr);
89  printf(" number of nonzero radiation matrix elements\n");
90  printf(" %" ITGFORMAT "\n",2*nmast-*ntr);
91  printf(" \n");
92 
93  /* switching from a SUPERdiagonal inventory to a SUBdiagonal one:
94  since the nonzeros are located in symmetric positions mast1rad
95  can be considered to contain the column numbers and irowrad the
96  row numbers; after sorting mast1rad the following results:
97 
98  - irowrad contains the row numbers of the SUBdiagonal
99  nonzero's, column per column
100  - mast1rad contains the column numbers
101 
102  Furthermore, the following fields are determined:
103 
104  - icolrad(i)=# SUBdiagonal nonzero's in column i
105  - jqrad(i)= location in field irow of the first SUBdiagonal
106  nonzero in column i */
107 
108  /* ordering the column numbers in mast1rad */
109 
110  FORTRAN(isortii,(mast1rad,irowrad,&nmast,&kflag));
111 
112  /* filtering out the diagonal elements and generating icolrad and jqrad */
113 
114  isubtract=0;
115  for(i=0;i<*ntr;++i){icolrad[i]=0;}
116  k=0;
117  for(i=0;i<nmast;++i){
118  if(mast1rad[i]==irowrad[i]){++isubtract;}
119  else{
120  mast1rad[i-isubtract]=mast1rad[i];
121  irowrad[i-isubtract]=irowrad[i];
122  if(k!=mast1rad[i]){
123  for(l=k;l<mast1rad[i];++l){jqrad[l]=i+1-isubtract;}
124  k=mast1rad[i];
125  }
126  ++icolrad[k-1];
127  }
128  }
129  nmast=nmast-isubtract;
130  for(l=k;l<*ntr+1;++l){jqrad[l]=nmast+1;}
131 
132  /* sorting the row numbers within each column */
133 
134  for(i=0;i<*ntr;++i){
135  if(jqrad[i+1]-jqrad[i]>0){
136  isize=jqrad[i+1]-jqrad[i];
137  FORTRAN(isortii,(&irowrad[jqrad[i]-1],&mast1rad[jqrad[i]-1],
138  &isize,&kflag));
139  }
140  }
141 
142  *nzsrad=jqrad[*ntr]-1;
143 
144  *mast1radp=mast1rad;
145  *irowradp=irowrad;
146 
147  return;
148 
149 }
#define ITGFORMAT
Definition: CalculiX.h:52
void insertrad(ITG *ipointer, ITG **mast1p, ITG **mast2p, ITG *i1, ITG *i2, ITG *ifree, ITG *nzs_)
Definition: insertrad.c:24
void FORTRAN(addimdnodecload,(ITG *nodeforc, ITG *i, ITG *imdnode, ITG *nmdnode, double *xforc, ITG *ikmpc, ITG *ilmpc, ITG *ipompc, ITG *nodempc, ITG *nmpc, ITG *imddof, ITG *nmddof, ITG *nactdof, ITG *mi, ITG *imdmpc, ITG *nmdmpc, ITG *imdboun, ITG *nmdboun, ITG *ikboun, ITG *nboun, ITG *ilboun, ITG *ithermal))
ITG strcpy1(char *s1, const char *s2, ITG length)
Definition: strcpy1.c:24
subroutine stop()
Definition: stop.f:19
subroutine isortii(ix, iy, n, kflag)
Definition: isortii.f:5
#define ITG
Definition: CalculiX.h:51
Hosted by OpenAircraft.com, (Michigan UAV, LLC)