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

Go to the source code of this file.

Functions

void insert (ITG *ipointer, ITG **irowp, ITG **nextp, ITG *i1, ITG *i2, ITG *ifree, ITG *nzs_)
 

Function Documentation

void insert ( ITG ipointer,
ITG **  irowp,
ITG **  nextp,
ITG i1,
ITG i2,
ITG ifree,
ITG nzs_ 
)

Definition at line 24 of file insert.c.

25  {
26 
27  /* inserts a new nonzero matrix position into the data structure
28  in FORTRAN notation:
29  - ipointer(i) points to a position in field irow containing
30  the row number of a nonzero position in column i;
31  next(ipointer(i)) points a position in field irow containing
32  the row number of another nonzero position in column i, and
33  so on until no nonzero positions in column i are left; for
34  the position j in field irow containing the momentarily last
35  nonzero number in column i we have next(j)=0
36 
37  notice that in C the positions start at 0 and not at 1 as in
38  FORTRAN; the present routine is written in FORTRAN convention */
39 
40  ITG idof1,idof2,istart,*irow=NULL,*next=NULL;
41 
42  irow=*irowp;
43  next=*nextp;
44 
45  if(*i1<*i2){
46  idof1=*i1;
47  idof2=*i2;
48  }
49  else{
50  idof1=*i2;
51  idof2=*i1;
52  }
53 
54  if(ipointer[idof2-1]==0){
55  ++*ifree;
56  if(*ifree>*nzs_){
57  *nzs_=(ITG)(1.1**nzs_);
58  RENEW(irow,ITG,*nzs_);
59  RENEW(next,ITG,*nzs_);
60  }
61  ipointer[idof2-1]=*ifree;
62  irow[*ifree-1]=idof1;
63  next[*ifree-1]=0;
64  }
65  else{
66  istart=ipointer[idof2-1];
67  while(1){
68  if(irow[istart-1]==idof1) break;
69  if(next[istart-1]==0){
70  ++*ifree;
71  if(*ifree>*nzs_){
72  *nzs_=(ITG)(1.1**nzs_);
73  RENEW(irow,ITG,*nzs_);
74  RENEW(next,ITG,*nzs_);
75  }
76  next[istart-1]=*ifree;
77  irow[*ifree-1]=idof1;
78  next[*ifree-1]=0;
79  break;
80  }
81  else{
82  istart=next[istart-1];
83  }
84  }
85  }
86 
87  *irowp=irow;
88  *nextp=next;
89 
90  return;
91 
92 }
#define RENEW(a, b, c)
Definition: CalculiX.h:40
#define ITG
Definition: CalculiX.h:51
Hosted by OpenAircraft.com, (Michigan UAV, LLC)