1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
/* CalculiX - A 3-dimensional finite element program */
/* Copyright (C) 1998-2015 Guido Dhondt */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License as */
/* published by the Free Software Foundation(version 2); */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "CalculiX.h"
void insert(ITG *ipointer, ITG **mast1p, ITG **nextp, ITG *i1,
ITG *i2, ITG *ifree, ITG *nzs_){
/* routine for the lower triangular matrix, excluding the diagonal */
/* inserts a new nonzero matrix position into the data structure
in FORTRAN notation:
- ipointer(i) points to a position in field mast1 containing
the row number of a nonzero position in column i;
next(ipointer(i)) points a position in field mast1 containing
the row number of another nonzero position in column i, and
so on until no nonzero positions in column i are left; for
the position j in field mast1 containing the momentarily last
nonzero number in column i we have next(j)=0
notice that in C the positions start at 0 and not at 1 as in
FORTRAN; the present routine is written in FORTRAN convention */
ITG idof1,idof2,istart,*mast1=NULL,*next=NULL;
mast1=*mast1p;
next=*nextp;
if(*i1==*i2) return;
if(*i1<*i2){
idof1=*i2;
idof2=*i1-1;
}
else{
idof1=*i1;
idof2=*i2-1;
}
// index=ipointer[idof2];
if(*ifree>=*nzs_){
*nzs_=(ITG)(1.1**nzs_);
RENEW(mast1,ITG,*nzs_);
RENEW(next,ITG,*nzs_);
}
mast1[*ifree]=idof1;
next[*ifree]=ipointer[idof2];
ipointer[idof2]=++*ifree;
/* if(ipointer[idof2]==0){
if(*ifree>=*nzs_){
*nzs_=(ITG)(1.1**nzs_);
RENEW(mast1,ITG,*nzs_);
RENEW(next,ITG,*nzs_);
}
mast1[*ifree]=idof1;
next[*ifree]=0;
ipointer[idof2]=++*ifree;
}
else{
istart=ipointer[idof2]-1;
while(1){
if(mast1[istart]==idof1) break;
if(next[istart]==0){
if(*ifree>=*nzs_){
*nzs_=(ITG)(1.1**nzs_);
RENEW(mast1,ITG,*nzs_);
RENEW(next,ITG,*nzs_);
}
mast1[*ifree]=idof1;
next[*ifree]=0;
next[istart]=++*ifree;
break;
}
else{
istart=next[istart]-1;
}
}
}*/
*mast1p=mast1;
*nextp=next;
return;
}
|