root/src/frdheader.c

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

DEFINITIONS

This source file includes following definitions.
  1. frdheader

   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 frdheader(ITG *icounter,double *oner,double *time,double *pi,
  25                ITG *noddiam,double *cs,ITG *null,ITG *mode,
  26                ITG *noutloc,char *description,ITG *kode,ITG *nmethod,
  27                FILE *f1, char *output,ITG *istep,ITG *iinc){
  28 
  29   char tmp[132],text[132];
  30 
  31   ITG i,ncomma;
  32   
  33   /* icounter counts the number of loadcases in the frd-file 
  34      kode counts the number of increments in the frd-file */
  35 
  36   strcpy1(&text[0],"    1PSTEP",10);
  37   for(i=10;i<70;i++)text[i]=' ';text[70]='\0';
  38   (*icounter)++;
  39   sprintf(&text[24],"%12" ITGFORMAT "",*icounter);
  40   sprintf(&text[36],"%12" ITGFORMAT "",*iinc);
  41   sprintf(&text[48],"%12" ITGFORMAT "",*istep);text[60]=' ';
  42   fprintf(f1,"%s\n",text);
  43 
  44   /* additional headers for frequency calculations */
  45 
  46   if((*nmethod==2)||(*nmethod==6)||(*nmethod==7)){
  47     strcpy1(&text[0],"    1PGM",8);
  48     for(i=8;i<70;i++)text[i]=' ';text[70]='\0';
  49     sprintf(&text[24],"%12.6E",*oner);text[36]=' ';
  50     fprintf(f1,"%s\n",text);
  51 
  52     strcpy1(&text[0],"    1PGK",8);
  53     for(i=8;i<70;i++)text[i]=' ';text[70]='\0';
  54     sprintf(&text[24],"%12.6E",(*time*2.**pi)*(*time*2.**pi));text[36]=' ';
  55     fprintf(f1,"%s\n",text);
  56 
  57     strcpy1(&text[0],"    1PHID",9);
  58     for(i=9;i<70;i++)text[i]=' ';text[70]='\0';
  59     sprintf(&text[24],"%12" ITGFORMAT "",*noddiam);text[36]=' ';
  60     fprintf(f1,"%s\n",text);
  61 
  62     /* additional headers for cyclic symmetry calculations */
  63 
  64     if((*noddiam>=0)&&(cs!=NULL)){
  65       strcpy1(&text[0],"    1PAX",8);
  66       for(i=8;i<24;i++)text[i]=' ';
  67       sprintf(&text[24],"%12.5E",cs[5]);
  68       sprintf(&text[36],"%12.5E",cs[6]);
  69       sprintf(&text[48],"%12.5E",cs[7]);
  70       sprintf(&text[60],"%12.5E",cs[8]);
  71       sprintf(&text[72],"%12.5E",cs[9]);
  72       sprintf(&text[84],"%12.5E",cs[10]);
  73       fprintf(f1,"%s\n",text);
  74     }
  75 
  76     strcpy1(&text[0],"    1PSUBC",10);
  77     for(i=10;i<70;i++)text[i]=' ';text[70]='\0';
  78     sprintf(&text[24],"%12" ITGFORMAT "",*null);text[36]=' ';
  79     fprintf(f1,"%s\n",text);
  80 
  81     strcpy1(&text[0],"    1PMODE",10);
  82     for(i=10;i<70;i++)text[i]=' ';text[70]='\0';
  83     sprintf(&text[24],"%12" ITGFORMAT "",*mode+1);text[36]=' ';
  84     fprintf(f1,"%s\n",text);
  85   }
  86 
  87 #ifdef COMPANY
  88   writeBasisParameter(f1,istep,iinc);
  89 #endif    
  90      
  91   /* 100CL line */
  92  
  93   for(i=0;i<75;i++)text[i]=' ';
  94   if(abs(*nmethod)==1){
  95     strcpy1(&text[0],"  100CL       .00000E+00                                 0    1",63);
  96   }else if(*nmethod==2){
  97     strcpy1(&text[0],"  100CL       .00000E+00                                 2    1",63);
  98   }else if(*nmethod==3){
  99     strcpy1(&text[0],"  100CL       .00000E+00                                 4    1",63);
 100   }else if((*nmethod==4)||(*nmethod==5)){
 101     strcpy1(&text[0],"  100CL       .00000E+00                                 1    1",63);
 102   }else{
 103     strcpy1(&text[0],"  100CL       .00000E+00                                 3    1",63);
 104   }
 105 
 106   sprintf(tmp,"%12" ITGFORMAT "",*noutloc);
 107   strcpy1(&text[24],tmp,12);
 108   strcpy1(&text[36],description,12);
 109   if(*nmethod==2)strcpy1(&text[63],"MODAL",5);
 110   if(strcmp1(output,"asc")==0){
 111     strcpy1(&text[74],"1",1);
 112   }else{
 113     strcpy1(&text[74],"2",1);
 114   }
 115   sprintf(tmp,"%5" ITGFORMAT "",100+(*kode));
 116   strcpy1(&text[7],tmp,5);
 117 //  sprintf(tmp,"%12.5E",*time);
 118 
 119   if((*time<=0.)||(*nmethod==2)){
 120       sprintf(tmp,"%12.5E",*time);
 121   }else if((log10(*time)>=0)&&(log10(*time)<10.)){
 122       ncomma=10-floor(log10(*time)+1.);
 123       if(ncomma==0){
 124           sprintf(tmp,"%12.0f",*time);
 125       }else if(ncomma==1){
 126           sprintf(tmp,"%12.1f",*time);
 127       }else if(ncomma==2){
 128           sprintf(tmp,"%12.2f",*time);
 129       }else if(ncomma==3){
 130           sprintf(tmp,"%12.3f",*time);
 131       }else if(ncomma==4){
 132           sprintf(tmp,"%12.4f",*time);
 133       }else if(ncomma==5){
 134           sprintf(tmp,"%12.5f",*time);
 135       }else if(ncomma==6){
 136           sprintf(tmp,"%12.6f",*time);
 137       }else if(ncomma==7){
 138           sprintf(tmp,"%12.7f",*time);
 139       }else if(ncomma==8){
 140           sprintf(tmp,"%12.8f",*time);
 141       }else{
 142           sprintf(tmp,"%12.9f",*time);
 143       }
 144   }else{
 145       sprintf(tmp,"%12.5E",*time);
 146   }
 147 
 148   strcpy1(&text[12],tmp,12);
 149   sprintf(tmp,"%5" ITGFORMAT "",*kode);
 150   strcpy1(&text[58],tmp,5);
 151   text[75]='\0';
 152   fprintf(f1,"%s\n",text);
 153 
 154 }
 155 
 156 /*
 157 !
 158 !     CalculiX - A 3-dimensional finite element program
 159 !              Copyright (C) 1998-2015 Guido Dhondt
 160 !
 161 !     This program is free software; you can redistribute it and/or
 162 !     modify it under the terms of the GNU General Public License as
 163 !     published by the Free Software Foundation(version 2);
 164 !     
 165 !
 166 !     This program is distributed in the hope that it will be useful,
 167 !     but WITHOUT ANY WARRANTY; without even the implied warranty of 
 168 !     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 169 !     GNU General Public License for more details.
 170 !
 171 !     You should have received a copy of the GNU General Public License
 172 !     along with this program; if not, write to the Free Software
 173 !     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 174 !
 175       subroutine frdheader(icounter,oner,time,pi,noddiam,cs,null,mode,
 176      &  noutloc,description,kode,nmethod,fmat)
 177 !
 178 !     stores the results header in frd format
 179 !
 180       implicit none
 181 !
 182       character*8 fmat
 183       character*12 description
 184       character*132 text
 185 !
 186       integer  icounter,noddiam,null,mode,noutloc,kode,nmethod
 187 !
 188       real*8 oner,time,pi,cs(17,*)
 189 !
 190       text='    1PSTEP'
 191       icounter=icounter+1
 192       write(text(25:36),'(i12)') icounter
 193       write(7,'(a132)') text
 194       if(nmethod.eq.2) then
 195          text='    1PGM'
 196          write(text(25:36),'(e12.6)') oner
 197          write(7,'(a132)') text
 198          text='    1PGK'
 199          write(text(25:36),'(e12.6)') (time*2.d0*pi)**2
 200          write(7,'(a132)') text
 201          text='    1PHID'
 202          write(text(25:36),'(i12)') noddiam
 203          write(7,'(a132)') text
 204          if(noddiam.ge.0) then
 205             text='    1PAX'
 206             write(text(25:36),'(1p,e12.5)') cs(6,1)
 207             write(text(37:48),'(1p,e12.5)') cs(7,1)
 208             write(text(49:60),'(1p,e12.5)') cs(8,1)
 209             write(text(61:72),'(1p,e12.5)') cs(9,1)
 210             write(text(73:84),'(1p,e12.5)') cs(10,1)
 211             write(text(85:96),'(1p,e12.5)') cs(11,1)
 212             write(7,'(a132)') text
 213          endif
 214          text='    1PSUBC'
 215          write(text(25:36),'(i12)') null
 216          write(7,'(a132)') text
 217          text='    1PMODE'
 218          write(text(25:36),'(i12)') mode+1
 219          write(7,'(a132)') text
 220       endif
 221 !     
 222       if(abs(nmethod).eq.1) then
 223          text=
 224      & '  100CL       .00000E+00                                 0    1'
 225       elseif(nmethod.eq.2) then
 226          text=
 227      & '  100CL       .00000E+00                                 2    1'
 228       elseif(nmethod.eq.3) then
 229          text=
 230      & '  100CL       .00000E+00                                 4    1'
 231       elseif((nmethod.eq.4).or.(nmethod.eq.5)) then
 232          text=
 233      & '  100CL       .00000E+00                                 1    1'
 234       else
 235          text=
 236      & '  100CL       .00000E+00                                 3    1'
 237       endif
 238       write(text(25:36),'(i12)') noutloc
 239       text(37:48)=description
 240       if(nmethod.eq.2) text(64:68)='MODAL'
 241       text(75:75)='1'
 242       write(text(8:12),'(i5)') 100+kode
 243       write(text(13:24),fmat) time
 244       write(text(59:63),'(i5)') kode
 245       write(7,'(a132)') text
 246 !     
 247       return
 248       end*/
 249       
 250       
 251       

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