root/src/remastructem.c

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

DEFINITIONS

This source file includes following definitions.
  1. remastructem

   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 remastructem(ITG *ipompc, double **coefmpcp, ITG **nodempcp, ITG *nmpc,
  25               ITG *mpcfree, ITG *nodeboun, ITG *ndirboun, ITG *nboun,
  26               ITG *ikmpc, ITG *ilmpc, ITG *ikboun, ITG *ilboun,
  27               char *labmpc, ITG *nk,
  28               ITG *memmpc_, ITG *icascade, ITG *maxlenmpc,
  29               ITG *kon, ITG *ipkon, char *lakon, ITG *ne,
  30               ITG *nactdof, ITG *icol, ITG *jq, ITG **irowp, ITG *isolver,
  31               ITG *neq, ITG *nzs,ITG *nmethod, double **fp,
  32               double **fextp, double **bp, double **aux2p, double **finip,
  33               double **fextinip,double **adbp, double **aubp, ITG *ithermal,
  34               ITG *iperturb, ITG *mass, ITG *mi, ITG *ielmat, double *elcon,
  35               ITG *ncmat_, ITG *ntmat_,ITG *inomat){
  36 
  37     /* reconstructs the nonzero locations in the stiffness and mass
  38        matrix after a change in MPC's */
  39 
  40     ITG *nodempc=NULL,*mast1=NULL,*ipointer=NULL,mpcend,mpcmult,
  41         callfrommain,i,*irow=NULL,mt;
  42 
  43     double *coefmpc=NULL,*f=NULL,*fext=NULL,*b=NULL,*aux2=NULL,
  44         *fini=NULL,*fextini=NULL,*adb=NULL,*aub=NULL;
  45     
  46     nodempc=*nodempcp;coefmpc=*coefmpcp;irow=*irowp;
  47     f=*fp;fext=*fextp;b=*bp;aux2=*aux2p;fini=*finip;
  48     fextini=*fextinip;adb=*adbp;aub=*aubp;
  49 
  50     mt=mi[1]+1;
  51 
  52     /* decascading the MPC's */
  53 
  54     printf(" Decascading the MPC's\n\n");
  55    
  56     callfrommain=0;
  57     cascade(ipompc,&coefmpc,&nodempc,nmpc,
  58             mpcfree,nodeboun,ndirboun,nboun,ikmpc,
  59             ilmpc,ikboun,ilboun,&mpcend,&mpcmult,
  60             labmpc,nk,memmpc_,icascade,maxlenmpc,
  61             &callfrommain,iperturb,ithermal);
  62 
  63     /* determining the matrix structure */
  64     
  65     printf(" Determining the structure of the matrix:\n");
  66  
  67     if(nzs[1]<10) nzs[1]=10;   
  68     NNEW(mast1,ITG,nzs[1]);
  69     NNEW(ipointer,ITG,mt**nk);
  70     RENEW(irow,ITG,nzs[1]);for(i=0;i<nzs[1];i++) irow[i]=0;
  71     
  72     mastructem(nk,kon,ipkon,lakon,ne,nodeboun,ndirboun,nboun,ipompc,
  73              nodempc,nmpc,nactdof,icol,jq,&mast1,&irow,isolver,neq,
  74              ikmpc,ilmpc,ipointer,nzs,ithermal,mi,ielmat,elcon,
  75              ncmat_,ntmat_,inomat);
  76 
  77     SFREE(ipointer);SFREE(mast1);
  78     RENEW(irow,ITG,nzs[2]);
  79     
  80     *nodempcp=nodempc;*coefmpcp=coefmpc;*irowp=irow;
  81 
  82     /* reallocating fields the size of which depends on neq[1] or *nzs */
  83 
  84     RENEW(f,double,neq[1]);for(i=0;i<neq[1];i++) f[i]=0.;
  85     RENEW(fext,double,neq[1]);for(i=0;i<neq[1];i++) fext[i]=0.;
  86     RENEW(b,double,neq[1]);for(i=0;i<neq[1];i++) b[i]=0.;
  87     RENEW(fini,double,neq[1]);for(i=0;i<neq[1];i++) fini[i]=0.;
  88 
  89     if(*nmethod==4){
  90         RENEW(aux2,double,neq[1]);for(i=0;i<neq[1];i++) aux2[i]=0.;
  91         RENEW(fextini,double,neq[1]);for(i=0;i<neq[1];i++) fextini[i]=0.;
  92         RENEW(adb,double,neq[1]);for(i=0;i<neq[1];i++) adb[i]=0.;
  93         RENEW(aub,double,nzs[1]);for(i=0;i<nzs[1];i++) aub[i]=0.;
  94         mass[0]=1;
  95     }
  96 
  97     *fp=f;*fextp=fext;*bp=b;*aux2p=aux2;*finip=fini;
  98     *fextinip=fextini;*adbp=adb;*aubp=aub;
  99 
 100     return;
 101 }
 102 
 103 

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