1 /*     CalculiX - A 3-dimensional finite element program                 */
2 /*              Copyright (C) 1998-2021 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 
remastructar(ITG * ipompc,double ** coefmpcp,ITG ** nodempcp,ITG * nmpc,ITG * mpcfree,ITG * nodeboun,ITG * ndirboun,ITG * nboun,ITG * ikmpc,ITG * ilmpc,ITG * ikboun,ITG * ilboun,char * labmpc,ITG * nk,ITG * memmpc_,ITG * icascade,ITG * maxlenmpc,ITG * kon,ITG * ipkon,char * lakon,ITG * ne,ITG * nactdof,ITG * icol,ITG * jq,ITG ** irowp,ITG * isolver,ITG * neq,ITG * nzs,ITG * nmethod,ITG * ithermal,ITG * iperturb,ITG * mass,ITG * mi,ITG * ics,double * cs,ITG * mcs,ITG * mortar,char * typeboun,ITG * iit,ITG * network,ITG * iexpl)24 void remastructar(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, ITG *ithermal,
32 	      ITG *iperturb, ITG *mass, ITG *mi, ITG *ics, double *cs,
33 	      ITG *mcs,ITG *mortar,char *typeboun,ITG *iit,
34 	      ITG *network,ITG *iexpl){
35 
36     /* reconstructs the nonzero locations in the stiffness and mass
37        matrix after a change in MPC's or the generation of contact
38        spring elements: version for frequency calculations (called
39        by arpack, arpackcs and linstatic)  */
40 
41     ITG *nodempc=NULL,*mast1=NULL,*ipointer=NULL,mpcend,
42         callfrommain,i,*irow=NULL,mt;
43 
44     double *coefmpc=NULL;
45 
46     nodempc=*nodempcp;coefmpc=*coefmpcp;irow=*irowp;
47 
48     mt=mi[1]+1;
49 
50     /* decascading the MPC's */
51 
52     printf(" Decascading the MPC's\n\n");
53 
54     callfrommain=0;
55     cascade(ipompc,&coefmpc,&nodempc,nmpc,
56 	    mpcfree,nodeboun,ndirboun,nboun,ikmpc,
57 	    ilmpc,ikboun,ilboun,&mpcend,
58 	    labmpc,nk,memmpc_,icascade,maxlenmpc,
59             &callfrommain,iperturb,ithermal);
60 
61     /* determining the matrix structure */
62 
63     printf(" Determining the structure of the matrix:\n");
64 
65     if(nzs[1]<10) nzs[1]=10;
66     NNEW(mast1,ITG,nzs[1]);
67     RENEW(irow,ITG,nzs[1]);
68 
69     if((*mcs==0)||(cs[1]<0)){
70 
71 	NNEW(ipointer,ITG,mt**nk);
72 
73 	mastruct(nk,kon,ipkon,lakon,ne,nodeboun,ndirboun,nboun,ipompc,
74 	     nodempc,nmpc,nactdof,icol,jq,&mast1,&irow,isolver,neq,
75 	     ikmpc,ilmpc,ipointer,nzs,nmethod,ithermal,
76 	     ikboun,ilboun,iperturb,mi,mortar,typeboun,labmpc,
77 	     iit,icascade,network,iexpl);
78 
79     }else{
80 
81       NNEW(ipointer,ITG,8**nk);
82 
83       mastructcs(nk,kon,ipkon,lakon,ne,nodeboun,ndirboun,nboun,
84 		 ipompc,nodempc,nmpc,nactdof,icol,jq,&mast1,&irow,isolver,
85 		 neq,ikmpc,ilmpc,ipointer,nzs,nmethod,
86 		 ics,cs,labmpc,mcs,mi,mortar);
87     }
88 
89     SFREE(ipointer);SFREE(mast1);
90     RENEW(irow,ITG,nzs[2]);
91 
92     *nodempcp=nodempc;*coefmpcp=coefmpc;*irowp=irow;
93 
94     return;
95 }
96 
97 
98