root/src/insertrad.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. insertrad

   1 /*     CalculiX - A 3-dimensional finite element program                 */
   2 /*              Copyright (C) 1998-2015 Guido Dhondt                          */
   3 
   4 /*     This program is free software; you can redistribute it and/or     */
   5 /*     modify it under the terms of the GNU General Public License as    */
   6 /*     published by the Free Software Foundation(version 2);    */
   7 /*                                                                       */
   8 
   9 /*     This program is distributed in the hope that it will be useful,   */
  10 /*     but WITHOUT ANY WARRANTY; without even the implied warranty of    */ 
  11 /*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      */
  12 /*     GNU General Public License for more details.                      */
  13 
  14 /*     You should have received a copy of the GNU General Public License */
  15 /*     along with this program; if not, write to the Free Software       */
  16 /*     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.         */
  17 
  18 #include <stdlib.h>
  19 #include <math.h>
  20 #include <stdio.h>
  21 #include <string.h>
  22 #include "CalculiX.h"
  23 
  24 void insertrad(ITG *ipointer, ITG **irowp, ITG **nextp, ITG *i1,
  25             ITG *i2, ITG *ifree, ITG *nzs_){
  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          special version of insert.c for the call in mastructrad.c
  38 
  39        notice that in C the positions start at 0 and not at 1 as in 
  40        FORTRAN; the present routine is written in FORTRAN convention */
  41 
  42   ITG *irow=NULL,*next=NULL;
  43 
  44   irow=*irowp;
  45   next=*nextp;
  46 
  47   ++*ifree;
  48   if(*ifree>*nzs_){
  49       *nzs_=(ITG)(1.1**nzs_);
  50       RENEW(irow,ITG,*nzs_);
  51       RENEW(next,ITG,*nzs_);
  52   }
  53   
  54   irow[*ifree-1]=*i2;
  55   next[*ifree-1]=ipointer[*i1-1];
  56   ipointer[*i1-1]=*ifree;
  57 
  58   *irowp=irow;
  59   *nextp=next;
  60   
  61   return;
  62 
  63 }

/* [<][>][^][v][top][bottom][index][help] */